I am using the built-in data type Day (Data.Time) in two ways

data PDate = PDate Day

or

type PDate Day

doesn't seem to matter. But then this doesn't work

testrec1 = PDate 2021 7 1

I always must use the "helper function" fromGregorian

testrec0 = PDate (fromGregorian 2021 7 1)
...
PDate 2021-07-01

Looking at Real World Haskell examples

data BookInfo = Book Int String [String]  deriving (Show)
...
myInfo = Book 9780135072455 "Algebra of Programming" ["Richard Bird", "Oege de Moor"]

I know there's a great Haskell lesson to learn here, so why can Book take everything naked but my Day version not?



Lawrence Bottorff
Grand Marais, MN, USA