blob: f25da543f7b236b1d3c5580eb9b2ced64142085a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
module Constant where
newtype Constant a b =
Constant { getConstant :: a }
deriving (Eq, Ord, Show)
instance Functor (Constant a) where
fmap _ (Constant x) = Constant x
instance Monoid a
=> Applicative (Constant a) where
pure x = Constant mempty
(Constant x) <*> (Constant y) = Constant $ mappend x y
|