
19 Apr
2016
19 Apr
'16
11:59 p.m.
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]) else Right <$> sequence (fmap (helper show) [0,1])
The above will fail stating...
<snip>
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: https://wiki.haskell.org/Monomorphism_restriction