How to reference an already existing type variable in a haskell type spec?
I wish to type spec a function f' defined inside a function f so that both
of their type specs refer to the same type variable. However, when I try
to do this, I get a compile error from the compiler, which assumes that
the m outside and the m inside are not the same type variable. Any tip on
how to fix this?
f :: (Monad m) => (String -> Int -> String -> m ()) -> [String] -> m ()
f _ (x:_) = f' Nothing x
where
f' :: (Maybe Int) -> String -> m () -- when I comment this line, the
code compiles
f' _ _ = return ()
main = undefined
No comments:
Post a Comment