[Haskell-cafe] Typeclass Constraint Causing Typechecker to Fail
b at chreekat.net
Tue Apr 19 23:59:30 UTC 2016
On Tue, Apr 19, 2016 at 04:24:26PM -0700, James M wrote:
> Below I have a contrived example. Please do not take this to be real
> world code.
> f :: (Show a) => Int -> (Int -> a) -> Int -> IO a
> f i g x = do
> print i
> return $ g (x + i)
> foo :: Bool -> IO (Either [Int] [String])
> foo b = do
> let helper = f 2
> if b then
> Left <$> sequence (fmap (helper negate) [0,1])
> Right <$> sequence (fmap (helper show) [0,1])
> The above will fail stating...
> This seems to be a bug in the typechecker, and maybe it is a well
> known issue.
> Can someone please confirm that this is a bug and whether or not it
> is known?
I believe you have discovered everyone's favorite Haskell feature:
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 801 bytes
Desc: Digital signature
More information about the Haskell-Cafe