1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

🔥 >>> in favour of <>.

This commit is contained in:
Rob Rix 2019-06-27 15:26:30 -04:00
parent 383342bf9c
commit 22c478bf45
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 5 additions and 11 deletions

View File

@ -99,8 +99,8 @@ prog3 = fromBody $ lams [foo, bar, quux]
prog4 :: File (Core Name)
prog4 = fromBody
$ let' foo .= Core.bool True
>>> if' (pure foo)
$ let' foo .= Core.bool True
<> if' (pure foo)
(Core.bool True)
(Core.bool False)
where foo = User "foo"

View File

@ -5,7 +5,6 @@ module Data.Core
, CoreF(..)
, Edge(..)
, let'
, (>>>)
, block
, lam
, lams
@ -83,28 +82,23 @@ infix 3 :=
infixl 4 :.
instance Semigroup (Core a) where
(<>) = fmap Core . (:>>)
a <> b = Core (a :>> b)
instance Applicative Core where
pure = Core . Var
(<*>) = ap
instance Monad Core where
a >>= f = gfold id let' (>>>) (Core . Lam) ($$) unit bool if' string load edge frame (...) (.=) (fmap Core . Ann) pure (f <$> a)
a >>= f = gfold id let' (<>) (Core . Lam) ($$) unit bool if' string load edge frame (...) (.=) (fmap Core . Ann) pure (f <$> a)
let' :: Name -> Core a
let' = Core . Let
(>>>) :: Core a -> Core a -> Core a
a >>> b = Core (a :>> b)
infixr 1 >>>
block :: Foldable t => t (Core a) -> Core a
block cs
| null cs = unit
| otherwise = foldr1 (>>>) cs
| otherwise = foldr1 (<>) cs
lam :: Eq a => a -> Core a -> Core a
lam n b = Core (Lam (bind n b))