0

I am trying to seperate Strings with " ," with "intersperse". (Beginner in Haskell ) But my program refuses to compile , because I get the error "Not in scope intersperse" Therefore I wrote import Data.Char at the top of my program , but the problem keeps refusing to compile.

 import Data.Char

 myShow :: String -> String
 myShow s = concat ["[", intersperse ',' s, "]"]

What to do ? Thanks.

Blnpwr
  • 1,793
  • 4
  • 22
  • 43

1 Answers1

0

You have to add

import Data.List

Because intersperse functoion is it's part. So your programm going to look like

 import Data.Char
 import Data.List

 myShow :: String -> String
 myShow s = concat ["[", intersperse ',' s, "]"]
JagaJaga
  • 76
  • 2