On 8/9/07, rodrigo.bonifacio <rodrigo.bonifacio@uol.com.br> wrote:
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