0

I am trying to use Aeson to deal with json in haskell, in the documentation it shows the syntax for toEncoding as this:

toEncoding (Person name age) = pairs ("name" .= name <> "age" .= age)

however, when I try to compile this I get the error:

Not in scope: ‘<>’
Perhaps you meant one of these:
  ‘<*>’ (imported from Control.Applicative),
  ‘>>’ (imported from Control.Monad),
  ‘<$>’ (imported from Control.Applicative)

What am I doing wrong? Do I need to import (<>) somehow?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Marcus Ruddick
  • 9,795
  • 7
  • 28
  • 43
  • 5
    "do I need to import (<>) somehow?" -- Yes; add `import Data.Monoid` to your imports. You can search for Haskell identifiers (including operators) using [Hoogle](https://www.stackage.org/lts/hoogle). – duplode Feb 23 '17 at 04:33
  • 3
    Possible duplicate of [What is the meaning of the Haskell operator "<>"?](http://stackoverflow.com/questions/38838688/what-is-the-meaning-of-the-haskell-operator) – Alexis King Feb 23 '17 at 06:32
  • @duplode That should be an answer – jkeuhlen Mar 02 '17 at 19:24
  • @jkeuhlen I didn't answer because I expected this question to be closed, either as a typo or as a duplicate. I suggest you flag it as a duplicate of the question mentioned by Alexis King just above. – duplode Mar 02 '17 at 19:53
  • @duplode Fair enough. I was just skimming the unanswered questions and figured I'd mention it. – jkeuhlen Mar 02 '17 at 19:55

0 Answers0