pire-0.2.5

Copyright(c) Andreas Reuleaux 2015 - 2018
LicenseBSD2
MaintainerAndreas Reuleaux <rx@a-rx.info>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Smart

Description

smart constructors (and destructors) for Pire

Synopsis

Documentation

lam :: Eq a => a -> Expr a a -> Expr a a Source #

>>> lam "x" $ V "x"
Lam "x" Nothing (Scope (V (B ())))
>>> lam "x" $ V "f" :@ V "x"
Lam "x" Nothing (Scope (V (F (V "f")) :@ V (B ())))
>>> lam "y" $ lam "x" $ V "x" :@ V "y"
Lam "y" Nothing (Scope (Lam "x" Nothing (Scope (V (B ()) :@ V (F (V (B ())))))))
>>> lam "y" $ lam "x" $ V "x" :@ (V "y" :@ V "z")
Lam "y" Nothing (Scope (Lam "x" Nothing (Scope (V (B ()) :@ (V (F (V (B ()))) :@ V (F (V (F (V "z")))))))))

lam_ :: Eq t => t -> Expr t t -> Expr t t -> Expr t t Source #

(v : ty) -> b

elam :: Eq a => a -> Expr a a -> Expr a a Source #

lam' :: String -> Expr String String -> Expr String String Source #

>>> lam' "x" $ V "x"
Lam' "x" (Scope (V (B (Name "x" ()))))
>>> lam' "x" $ V "f" :@ V "x"
Lam' "x" (Scope (V (F (V "f")) :@ V (B (Name "x" ()))))
>>> lam' "y" $ lam' "x" $ V "x" :@ V "y"
Lam' "y" (Scope (Lam' "x" (Scope (V (B (Name "x" ())) :@ V (F (V (B (Name "y" ()))))))))

lams :: Eq a => [a] -> Expr a a -> Expr a a Source #

>>> lams ["x", "y"] $ V "z" :@ V "x"
Lams ["x","y"] (Scope (V (F (V "z")) :@ V (B 0)))
>>> lams ["x", "y"] $ lams ["a", "b"] $ V "x" :@ V "a"
Lams ["x","y"] (Scope (Lams ["a","b"] (Scope (V (F (V (B 0))) :@ V (B 0)))))

lams' :: [String] -> Expr String String -> Expr String String Source #

>>> lams' ["x", "y"] $ V "z" :@ V "x"
Lams' ["x","y"] (Scope (V (F (V "z")) :@ V (B (Name "x" 0))))

scope :: Expr t a -> Scope () (Expr t) a Source #

scopepl :: Expr t a -> Scope Int (Expr t) a Source #

scope' :: Expr t a -> Scope (Name String ()) (Expr t) a Source #

pi_ :: Eq a => a -> Expr a a -> Expr a a -> Expr a a Source #

(==>) :: IsString t => Expr t a -> Expr t a -> Expr t a infixr 5 Source #