@@ -2,9 +2,9 @@ module Data.Maybe.Last where
22
33import Prelude
44
5- import Control.Extend (class Extend , extend )
5+ import Control.Extend (class Extend )
66
7- import Data.Functor.Invariant (class Invariant , imapF )
7+ import Data.Functor.Invariant (class Invariant )
88import Data.Maybe (Maybe (..))
99import Data.Monoid (class Monoid )
1010import Data.Newtype (class Newtype )
@@ -21,31 +21,25 @@ newtype Last a = Last (Maybe a)
2121
2222derive instance newtypeLast :: Newtype (Last a ) _
2323
24- derive newtype instance eqLast :: Eq a => Eq (Last a )
24+ derive newtype instance eqLast :: ( Eq a ) => Eq (Last a )
2525
26- derive newtype instance ordLast :: Ord a => Ord (Last a )
26+ derive newtype instance ordLast :: ( Ord a ) => Ord (Last a )
2727
28- derive newtype instance boundedLast :: Bounded a => Bounded (Last a )
28+ derive newtype instance boundedLast :: ( Bounded a ) => Bounded (Last a )
2929
30- instance functorLast :: Functor Last where
31- map f (Last x) = Last (f <$> x)
30+ derive newtype instance functorLast :: Functor Last
3231
33- instance invariantLast :: Invariant Last where
34- imap = imapF
32+ derive newtype instance invariantLast :: Invariant Last
3533
36- instance applyLast :: Apply Last where
37- apply (Last f) (Last x) = Last (f <*> x)
34+ derive newtype instance applyLast :: Apply Last
3835
39- instance applicativeLast :: Applicative Last where
40- pure = Last <<< pure
36+ derive newtype instance applicativeLast :: Applicative Last
4137
42- instance bindLast :: Bind Last where
43- bind (Last x) f = Last (x >>= \y -> case f y of Last ma -> ma)
38+ derive newtype instance bindLast :: Bind Last
4439
45- instance monadLast :: Monad Last
40+ derive newtype instance monadLast :: Monad Last
4641
47- instance extendLast :: Extend Last where
48- extend f (Last x) = Last (extend (f <<< Last ) x)
42+ derive newtype instance extendLast :: Extend Last
4943
5044instance showLast :: Show a => Show (Last a ) where
5145 show (Last a) = " (Last " <> show a <> " )"
0 commit comments