[Haskell-cafe] Mixed Fraction data type

Galaxy Being borgauf at gmail.com
Wed Sep 15 03:50:27 UTC 2021

I'm looking at Sandy Maguire's _Thinking With Types_ and he's talking about
the cardinality of types. He introduces the product type

data MixedFraction a = Fraction
{ mixedBit :: Word8
, numerator :: a
, denominator :: a

How is this a type for holding mixed fractions such as 5-1/2?

Lawrence Bottorff
Grand Marais, MN, USA
borgauf at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210914/49de2f15/attachment.html>

More information about the Haskell-Cafe mailing list