I'm trying to use the Stream type defined in this package. After installing with with cabal, I tried defining the tail function on streams as a quick test :
import Stream
tail' :: Stream a -> Stream a
tail' (Cons x s) = s
which gives me this error message :
test.hs:3:14: error:
Not in scope: type constructor or class `Stream'
Perhaps you meant `StreamT' (imported from Stream)
test.hs:3:26: error:
Not in scope: type constructor or class `Stream'
Perhaps you meant `StreamT' (imported from Stream)
test.hs:4:12: error: Not in scope: data constructor `Cons'
Failed, modules loaded: none.
after some searches, I thought the problem might be that importing the module does not automatically import the type constructor Stream and constructor Cons with it. So I changed it to
import Stream (Stream, Cons)
tail' :: Stream a -> Stream a
tail' (Cons x s) = s
after which I get
test.hs:1:20: error: Module `Stream' does not export `Stream'
test.hs:1:28: error: Module `Stream' does not export `Cons'
Failed, modules loaded: none.
and this is puzzling. Do I have to alter the installed package and add Stream and Cons to its export list? Or am I not importing the module correctly?
Data.Stream. You must be importing something else. - András Kovács