syntax - How to create an alias for a function using Unicode characters in Haskell -


i want create unicode aliases standard functions in haskell library. here attempt.

{-# language unicodesyntax #-} {-# language nomonomorphismrestriction #-}  import qualified data.list list import qualified data.map  map import qualified data.set  set   -- convenient aliases common operations via unicode symbols. ∩ = set.intersection ∪ = set.union ⊆ = set.issubsetof ⊊ = set.ispropersubsetof ∈ = set.member   main = putstrln "hello world!" 

when try compile this, error

[~/desktop]$ ghc --make test.hs [1 of 1] compiling main             ( test.hs, test.o )  test.hs:10:1: parse error on input ‘∩’ [~/desktop]$  

i want use these unicode symbols infix operators, , without backticks. how 1 this?

you need surround new functions parantheses when declare them:

(∩) = set.intersection 

note need remove capital letters function import data.set, because set.intersection seen data constructor , not function (and doesn't exist in fact).


Comments