Home > Software engineering >  Where did the haskell list difference operator (\\) go?
Where did the haskell list difference operator (\\) go?

Time:09-27

Am I missing something? It seems I don't have the list difference operator defined...

$ ghci
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Prelude> "Hello World!" \\ "ell W"

<interactive>:1:16: error:
    Variable not in scope: (\\) :: [Char] -> [Char] -> t
Prelude> :t (\\)

<interactive>:1:1: error: Variable not in scope: \\
Prelude> :type (\\)

<interactive>:1:1: error: Variable not in scope: \\
Prelude> :type (  )
(  ) :: [a] -> [a] -> [a]

Did it get removed? (And if so, where do I look to see that?)

CodePudding user response:

It's in Data.List:

% ghci
GHCi, version 8.4.4: http://www.haskell.org/ghc/  :? for help
Prelude> :t (\\)

<interactive>:1:1: error: Variable not in scope: \\
Prelude> import Data.List
Prelude Data.List> :t (\\)
(\\) :: Eq a => [a] -> [a] -> [a]
  • Related