我有一个模块中的功能,看起来是这样的: module MyLibrary (throwIfNegative) where
throwIfNegative :: Integral i => i -> String
throwIfNegative n | n < 0 = error "negative"
| otherwise = "no worries"
当然我可以返回M
编译与GHC 6.12.1下面的Haskell程序产生一个错误: {-# LANGUAGE NoImplicitPrelude #-}
module Example where
import Prelude(Integer, fromInteger, (==))
f :: Integer -> Integer
f n
| n == 0 = 0
即: example.hs
我在写一个多平台的ncurses文本冒险游戏。所需的C库ncursesw为x86配置,但我的操作系统是Mac OS X 10.6.6 x86_64。 ghc --make -o rogue rogue.hs
[1 of 2] Compiling Dungeon (Dungeon.hs, Dungeon.o)
[2 of 2] Compiling Main (rogue.hs, rog