On Thu, 2007-02-01 at 21:01 -1000, Tim Newsham wrote:
> instance Second [a] a where
>      snd [] = error "don't got none"
>      snd (x:y:xs) = y 

Would'nt that instance mean this:
  snd [] produces error
  snd [x] gives []


I'd implement it something like this (if this works?):

instance Second [a] (Maybe a) where
     snd [] = Nothing
     snd [x] = Nothing
     snd (x:y:xs) = Just y 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to