
9 Aug
2007
9 Aug
'07
2:32 p.m.
On 8/9/07, rodrigo.bonifacio
Hi all.
I want to overload the operator "^" for working instead of the following "+++" operator:
(+++) :: String -> [[String]] -> [[String]] x +++ y = [ x:e | e<-y ]
How can I overload the "^" operator?
import Prelude hiding ( (^) ) -- this is the key (^) :: String -> [[String]] -> [[String]] x ^ y = [ x:e | e<-y ] By the way, there's nothing special about Strings here: if you made the type of ^ (^) :: a -> [[a]] -> [[a]] it would work on lists of any type, including String. -Brent