Type system compiler flags
Carsten Schultz
carsten at codimi.de
Tue Feb 1 19:26:46 CET 2011
Am 01.02.11 12:34, schrieb Daniel Fischer:
> On Tuesday 01 February 2011 11:45:58, Julian Bean wrote:
>>> It indeed does, even though I doubted it at first. As far as I
>>> remember the type in
>>>
>>> getnArrayST n bs :: ST s (Maybe (UArray Int Word8, [Word8])) =
>>>
>>> used to be necessary to bind the type variable s. Apparently things
>>> have become easier.
>>
>> The higher-rank inference has been changed quite a bit, but I think
>> -XPatternSignatures is all you were missing to get your original code to
>> compiler (well, at least to parse).
>
> No, I tried, the parser still choked on the above signature.
It seems that -XPatternSignatures is an old option replaced by
-XScopedTypeVariables.
By the way, it turned out that I had already adapted the library to a
newer version of ghc some time ago and only not found the source file
because I had also changed its name. In the new version I removed some
probably misguided optimisation and replaced the above code by the
following ;)
getnArray :: Int -> [Word8] -> Maybe (UArray Int Word8, [Word8])
getnArray n bs | length (take n bs) == n
= seq a (Just (a, bs''))
where (bs', bs'') = (take n bs, drop n bs)
a = listArray (0,n-1) bs'
getnArray _ _ = Nothing
So I am sorry that my question was unnecessary, but I am still glad that
I have learned that less work is now necessary to have the original code
type-check.
Thanks to both of you,
Carsten
More information about the Glasgow-haskell-users
mailing list