IO Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

IO Question

Nathan M. Holden
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20081230/338c9178/attachment.htm
Reply | Threaded
Open this post in threaded view
|

IO Question

Alexander Dunlap
On Tue, Dec 30, 2008 at 7:41 PM, Nathan Holden <[hidden email]> 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?

Alex