So, following along with a sample code on streams, this fails to be loaded into ghci:
data MyStream a = MyStream a (MyStream a)
intsFrom n :: MyStream Integer
intsFrom n = MyStream n $ intsFrom $ n + 1
Getting error:
stream.hs:3:1:
Invalid type signature: intsFrom n :: MyStream Integer
Should be of form <variable> :: <type>
Failed, modules loaded: none.
Any ideas? Thanks!
Update: If I just type intsFrom :: MyStream Integer I get error:
stream.hs:4:1:
The equation(s) for `intsFrom' have one argument,
but its type `MyStream Integer' has none
Failed, modules loaded: none.
It looks like you want your signature to be something like this:
Integerhere is your argument, andMyStream Integeris the result ofintsFrom.