Skip to content

Add Eq1, Ord1 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Data/Identity.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import Control.Comonad (class Comonad)
import Control.Extend (class Extend)
import Control.Lazy (class Lazy)

import Data.Eq (class Eq1)
import Data.Foldable (class Foldable)
import Data.Functor.Invariant (class Invariant, imapF)
import Data.Monoid (class Monoid)
import Data.Newtype (class Newtype)
import Data.Ord (class Ord1)
import Data.Traversable (class Traversable)

newtype Identity a = Identity a
Expand Down Expand Up @@ -46,6 +48,12 @@ derive newtype instance lazyIdentity :: Lazy a => Lazy (Identity a)
instance showIdentity :: Show a => Show (Identity a) where
show (Identity x) = "(Identity " <> show x <> ")"

instance eq1Identity :: Eq1 Identity where
eq1 = eq

instance ord1Identity :: Ord1 Identity where
compare1 = compare

instance functorIdentity :: Functor Identity where
map f (Identity x) = Identity (f x)

Expand Down