0

I'm working the "Optics by Example" haskell book.

Below is my dependencies in package.yaml of stack project-

dependencies:
- base >= 4.7 && < 5
- aeson
- containers
- lens
- lens-aeson
- mtl
- text

Below is my Haskell Code -

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE InstanceSigs #-}

import Control.Lens
import Control.Applicative

foldOf ( both . each ) (["super, "cali"], ["fragilistic", "expialidocious"])

I get below error at this line of code foldOf ( both . each ) (["super, "cali"], ["fragilistic", "expialidocious"]) -

lexical error in string/character literal at end of input

What am I doing wrong? How can I fix this error?

user51
  • 8,843
  • 21
  • 79
  • 158
  • 1
    Double check your quotes, one is missing. Also , you can't write an expression in a .hs file like this, you have to bind it to some variable, e.g. `x = 1+1`. If this is an application, you will have to define `main :: IO ()` as well. – chi Oct 04 '22 at 07:29

1 Answers1

4

Even Stack Overflow's code highlighter is pointing out the problem by highlighting your strings incorrectly. The error message tells you there's a problem in a string literal, so inspect them more closely. One of them doesn't have enough " characters.

amalloy
  • 89,153
  • 8
  • 140
  • 205