Haskell Language Infix operators Custom operators


In Haskell, you can define any infix operator you like. For example, I could define the list-enveloping operator as

(>+<) :: [a] -> [a] -> [a]
env >+< l = env ++ l ++ env

GHCi> "**">+<"emphasis"

You should always give such operators a fixity declaration, like

infixr 5 >+<

(which would mean >+< binds as tightly as ++ and : do).