[Haskell-beginners] Type constructor

mike h mike_k_houghton at yahoo.co.uk
Wed Nov 8 19:21:14 UTC 2017


Hi,

I’m modelling fractions with a view to looking at continued fractions and I have this recursive structure.

type Numerator   = Integer
data Fraction = Numbr Integer | F Numerator Fraction


in ghci I do 

λ-> :t F 1 (Numbr 2)
F 1 (Numbr 2) :: Fraction

which is fine. But what surprised me is that it also works without using Numbr e.g. 

λ-> :t F 1 2
F 1 2 :: Fraction

why is this? 

Thanks

Mike


More information about the Beginners mailing list