Search code examples
haskellsyntaxhugs

Haskell syntax error!


module Blabla (DDP, create, add, remove, addTr, removeTr, setAS, unsetAS, accepts, show) where
data DDP = [Integer] [Char] [Char] [(Integer,Char,Char,Integer,String)] Integer Char [Integer]

when I write that I got that error

Syntax error in data type declaration (unexpected `}', possibly due to bad layout)

what is the problem I can not figure out, thanks for helping...


Solution

  • DDP has no data constructor. Try

    data DDP = DDP [Integer] [Char] [Char] [(Integer,Char,Char,Integer,String)]
                   Integer Char [Integer]
      --  Note ^^^
    

    Aside: with so many fields, it might pay off to use record syntax instead. I don't know what your type is supposed to represent, so I can't show you how to apply it to DDP, but the Haskell wiki's example should be clear enough:

    data Person = Person { name :: String, age :: Int, address :: String }