我有一个haskell文件:
module Temp where
fails_haskell98 :: Monad m => m ()
fails_haskell98 = do
if True
then return ()
else fail "foo"
fails_haskell2010 :: Monad m => m ()
fails_haskell2010 = do
let exp = do
x <- return ()
return ()
exp
我可以用ghc-7.6.3编译的是我没有指定特定的haskell报告:
% ghc Temp.hs
[1 of 1] Compiling Temp ( Temp.hs, Temp.o )
但是,根据-XHaskell98
% ghc Temp.hs -XHaskell98
[1 of 1] Compiling Temp ( Temp.hs, Temp.o )
Temp.hs:5:6:
Unexpected semi-colons in conditional:
if True; then return (); else fail "foo"
Perhaps you meant to use -XDoAndIfThenElse?
根据-XHaskell2010
% ghc Temp.hs -XHaskell2010
[1 of 1] Compiling Temp ( Temp.hs, Temp.o )
Temp.hs:12:9: parse error on input `<-'
是否有报告标志我可以通过ghc(-XHaskellFoo
)来进行编译,因为它们没有任何标志?
这些显然都可以通过编辑源代码来修复,但我正在寻找一个不涉及该选项的选项。