Home > front end >  Haskell Lens : lexical error in string/character literal at end of input
Haskell Lens : lexical error in string/character literal at end of input

Time:10-04

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?

CodePudding user response:

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.

  • Related