##### λ Tony's Blog λ

## Lifting (Haskell addendum)

Posted on August 19, 2011A follow-on from Lifting. A port of the Scala code to Haskell follows.

```
class Lift f where
lift0 ::
-> f a
a
lift1 ::
-> b) -> f a -> f b
(a =
lift1 . lift0
ap
lift2 ::
-> b -> c) -> f a -> f b -> f c
(a =
lift2 f . lift1 f
ap
lift3 ::
-> b -> c -> d) -> f a -> f b -> f c -> f d
(a =
lift3 f a . lift2 f a
ap
ap ::
-> b) -> f a -> f b
f (a
-- scala.List
instance Lift [] where
=
lift0 error "todo"
=
ap error "todo"
-- scala.Option
instance Lift Maybe where
=
lift0 error "todo"
=
ap error "todo"
-- scala.Either[R, _]
instance Lift (Either r) where
=
lift0 error "todo"
=
ap error "todo"
-- scala.Functior1[R, _]
instance Lift ((->) r) where
=
lift0 error "todo"
=
ap error "todo"
```