Add Functor Either a
This commit is contained in:
@@ -304,8 +304,6 @@ pfunc arrayToList uses (Nil _::_) : ∀ a. Array a → List a := `(a,arr) => {
|
|||||||
return rval
|
return rval
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- for now I'll run this in JS
|
-- for now I'll run this in JS
|
||||||
pfunc lines uses (arrayToList) : String → List String := `(s) => Prelude_arrayToList(null,s.split('\n'))`
|
pfunc lines uses (arrayToList) : String → List String := `(s) => Prelude_arrayToList(null,s.split('\n'))`
|
||||||
|
|
||||||
@@ -725,6 +723,10 @@ instance Bifunctor _×_ where
|
|||||||
instance Functor IO where
|
instance Functor IO where
|
||||||
map f a = bind a $ \ a => pure (f a)
|
map f a = bind a $ \ a => pure (f a)
|
||||||
|
|
||||||
|
instance ∀ a. Functor (Either a) where
|
||||||
|
map f (Left x) = Left x
|
||||||
|
map f (Right y) = Right (f y)
|
||||||
|
|
||||||
uncurry : ∀ a b c. (a → b → c) → (a × b) → c
|
uncurry : ∀ a b c. (a → b → c) → (a × b) → c
|
||||||
uncurry f (a,b) = f a b
|
uncurry f (a,b) = f a b
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user