[Haskell-beginners] IO Question

Alexander Dunlap alexander.dunlap at gmail.com
Tue Dec 30 23:36:22 EST 2008

On Tue, Dec 30, 2008 at 7:41 PM, Nathan Holden <nathanmholden at gmail.com> wrote:
> I've been playing around with some types, and such, and I can get some basic
> IO. But the thing that confused me is this: How is it that IO [Char] ==
> [Char] can be True, but IO a == a is a type error? How can you implement eq
> for a type so that IO (type) == type?

The Eq type class is essentially defined as such:

class Eq a where
  (==) :: a -> a -> Bool

I don't know how you are even calling (==) on objects of type IO
[Char] and [Char], since the type signature of (==) says that both of
its arguments have to have the same type. Could you give more details
of what is going on?


More information about the Beginners mailing list