[Haskell-beginners] about the pattern matching
raeck at msn.com
Tue Dec 23 20:45:05 EST 2008
hi, good ... morning : )
I am just confused by the following code
> oneOnly :: [Int]
> oneOnly = 
> isOneOnly :: [Int] -> Bool
> isOneOnly oneOnly = True
> isOneOnly tester = False
what I want to do is to define a 'type' oneOnly as  and use it on
the pattern matching in function isOneOnly. But it does not work as
When I type
it will be True which is the result I expect but for
is OneOnly [1,2]
the result keeps True, it seems the second pattern has been ignored,
I think I try to achieve the purpose in a wrong way, any suggestion?
Thanks and Merry Christmas
Send e-mail anywhere. No map, no compass.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners