I\'m a beginner(ish) in Haskell and I find error message really hard to understand (I guess it comes with time). Anyway, to help me understanding my mistakes, I tried to add int
This should work:
f :: s -> s
f x =
let y = undefined :: s
in y
Just use the normal ::
operator as shown in the above example for type annotation.
Update:
It doesn't seem to work with polymorphic types. But it works with an concrete type.
The following typechecks:
f :: Int -> Int
f x = let m = x :: Int
in m
This produces error:
f1 :: a -> a
f1 x = let m = x :: a
in m