diff --git a/language/Type-Classes.md b/language/Type-Classes.md index 39816cfe..a7d91b21 100644 --- a/language/Type-Classes.md +++ b/language/Type-Classes.md @@ -147,11 +147,22 @@ derive instance ordPerson :: Ord Person ``` Currently, the following type classes can be derived: -- [Data.Generic.Rep (class Generic)](https://pursuit.purescript.org/packages/purescript-generics-rep/6.0.0/docs/Data.Generic.Rep#t:Generic) -- [Data.Eq (class Eq)](https://pursuit.purescript.org/packages/purescript-prelude/4.1.0/docs/Data.Eq#t:Eq) -- [Data.Ord (class Ord)](https://pursuit.purescript.org/packages/purescript-prelude/4.1.0/docs/Data.Ord#t:Ord) -- [Data.Functor (class Functor)](https://pursuit.purescript.org/packages/purescript-prelude/4.1.0/docs/Data.Functor#t:Functor) -- [Data.Newtype (class Newtype)](https://pursuit.purescript.org/packages/purescript-newtype/3.0.0/docs/Data.Newtype#t:Newtype) +- [Data.Generic.Rep (class Generic)](https://pursuit.purescript.org/packages/purescript-generics-rep/docs/Data.Generic.Rep#t:Generic) +- [Data.Eq (class Eq)](https://pursuit.purescript.org/packages/purescript-prelude/docs/Data.Eq#t:Eq) +- [Data.Ord (class Ord)](https://pursuit.purescript.org/packages/purescript-prelude/docs/Data.Ord#t:Ord) +- [Data.Functor (class Functor)](https://pursuit.purescript.org/packages/purescript-prelude/docs/Data.Functor#t:Functor) +- [Data.Newtype (class Newtype)](https://pursuit.purescript.org/packages/purescript-newtype/docs/Data.Newtype#t:Newtype) + +Other type classes may be derived via `Generic`: +```purescript +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Show (genericShow) + +derive instance genericPerson :: Generic Person _ + +instance showPerson :: Show Person where + show = genericShow +``` ## Compiler-Solvable Type Classes