Skip to content

Commit

Permalink
Rewrite some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vvscode committed May 2, 2018
1 parent e233419 commit 1cc5805
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ identity x = x

-- | Constant function.
-- const :: a -> b -> a
constant = \x y -> x
-- constant = \x y -> x
constant x y = x

-- apply :: (t1 -> t2) -> t1 -> t2
apply = \f x -> f x
-- apply = \f x -> f x
apply f x = f x

-- compose :: (t1 -> t2) -> (t3 -> t1) -> t3 -> t2
compose = \x y z -> x ( y (z))
-- compose = \x y z -> x ( y (z))
compose x y z = x ( y ( z ) )

-- flip :: (a -> b -> c) -> b -> a -> c
flip = \f x y -> f y x
-- flip = \f x y -> f y x
flip f x y = f y x

0 comments on commit 1cc5805

Please sign in to comment.