开发者

Haskell syntax error!

开发者 https://www.devze.com 2023-02-26 05:43 出处:网络
module Blabla (DDP, create, add, remove, addTr, removeTr, setAS, unsetAS, accepts, show) where data DDP = [Integer] [Char]

module Blabla (DDP, create, add, remove, addTr, removeTr, setAS, unsetAS, accepts, show) where

data DDP = [Integer] [Char] [Char] [(Integer,Char,Char,Integer,St开发者_如何学Goring)] 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...


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 }
0

精彩评论

暂无评论...
验证码 换一张
取 消