Type system compiler flags
Carsten Schultz
carsten at codimi.de
Tue Feb 1 10:20:26 CET 2011
Hello everyone,
I am trying to compile some code that I have written a long time ago
(might have been for ghc 6.3), and I have not done much Haskell in the
meantime. I have trouble compiling the code, maybe only because I do
not remember the necessary flags (yes, these should be in the source
files), maybe because ghc has changed. I do for example have functions
like this:
getnArray :: Int -> [Word8] -> Maybe (UArray Int Word8, [Word8])
getnArrayST :: Int -> [Word8] ->
(forall s . ST s (Maybe (UArray Int Word8, [Word8])))
getnArrayST n bs :: ST s (Maybe (UArray Int Word8, [Word8])) =
do
(a :: STUArray s Int Word8) <- newArray_ (0,n-1)
let loop k bs
| k == n = do fa <- freeze a
return $ Just (fa, bs)
| k < n = case bs of
(b:bs) -> do
writeArray a k b
loop (k+1) bs
[] -> return Nothing
loop 0 bs
getnArray n bs = runST (getnArrayST n bs)
Can someone suggest compiler flags which will make this compile with 6.8
and 6.12? I have tried
-XRankNTypes -XScopedTypeVariables -fglasgow-exts
but still get "Parse error in pattern" for the definition of getnArrayST.
Thanks for helping. As soon as I have overcome this problem, the real
fun will begin, because my program uses Template Haskell ;)
Carsten
More information about the Glasgow-haskell-users
mailing list