The Haskell prelude and Standard Library define a number of useful type classes.
Is there a page somewhere that lists the minimum complete definition for all these classes?
What's a typeclass in Haskell? A typeclass defines a set of methods that is shared across multiple types. For a type to belong to a typeclass, it needs to implement the methods of that typeclass. These implementations are ad-hoc: methods can have different implementations for different types.
An instance of a class is an individual object which belongs to that class. In Haskell, the class system is (roughly speaking) a way to group similar types. (This is the reason we call them "type classes"). An instance of a class is an individual type which belongs to that class.
Deriving means that your data type is automatically able to "derive" instances for certain type classes. In this case BaseballPlayer derives Show which means we can use any function that requires an instance of Show to work with BaseballPlayer .
This information can be found scattered around the Haskell language report as well as the GHC documentation, but in the interest of having an overview, I'm starting a CW answer for this.
==
or /=
.compare
or <=
.-
or negate
.toRational
.quotRem
and toInteger
..&.
, .|.
, xor
, complement
, either shift
or both shiftL
and shiftR
, either rotate
or both rotateL
and rotateR
, bitSize
and isSigned
.fromRational
and either /
or recip
.pi
, exp
, log
, sin
, cos
, sinh
, cosh
, asin
, acos
, atan
, asinh
, acosh
and atanh
.properFraction
.exponent
, significand
, scaleFloat
and atan2
.fmap
.pure
and <*>
.>>=
and return
.mplus
and mzero
.mfix
.foldMap
or foldr
.traverse
or sequenceA
..
and id
.arr
and first
.zeroArrow
.<+>
.left
.app
.loop
.readsPrec
(or, for GHC only, readPrec
).show
or showsPrec
.toEnum
and fromEnum
.minBound
and maxBound
.range
, index
, inRange
.mempty
and mappend
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With