Create basic lambda term type
This commit is contained in:
parent
b17c5d9d3d
commit
fc0ede9499
3 changed files with 31 additions and 1 deletions
|
|
@ -13,6 +13,8 @@ extra-doc-files:
|
|||
|
||||
dependencies:
|
||||
- base >= 4.7 && < 5
|
||||
- containers
|
||||
- text
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ cabal-version: 1.18
|
|||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 057a536ac3d0fd40b3122084eee53201158527bbcd0dbac7cec33d8fd06cf208
|
||||
-- hash: 5e16e68a3016455a93f44cbee36b19144a1a414a8cb0bf4a062a1566b7119a38
|
||||
|
||||
name: props
|
||||
version: 0.1.0.0
|
||||
|
|
@ -23,12 +23,15 @@ extra-doc-files:
|
|||
library
|
||||
exposed-modules:
|
||||
Props
|
||||
Props.Lambda
|
||||
other-modules:
|
||||
Paths_props
|
||||
hs-source-dirs:
|
||||
src
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
, containers
|
||||
, text
|
||||
default-language: Haskell2010
|
||||
|
||||
executable props
|
||||
|
|
@ -40,5 +43,7 @@ executable props
|
|||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
, containers
|
||||
, props
|
||||
, text
|
||||
default-language: Haskell2010
|
||||
|
|
|
|||
23
src/Props/Lambda.hs
Normal file
23
src/Props/Lambda.hs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Props.Lambda
|
||||
( Term(..)
|
||||
, displayTerm
|
||||
) where
|
||||
|
||||
import qualified Data.Set as Set
|
||||
import qualified Data.Text as T
|
||||
|
||||
type Name = T.Text
|
||||
type PreferredName = Maybe Name
|
||||
|
||||
-- | Lambda calculus term using De Bruijn indexing
|
||||
data Term a
|
||||
= Var PreferredName Int
|
||||
| Lambda PreferredName (Term a)
|
||||
| App (Term a) (Term a)
|
||||
| Native a
|
||||
deriving (Show)
|
||||
|
||||
displayTerm :: (Set.Set Name -> a -> T.Text) -> Term a -> T.Text
|
||||
displayTerm = undefined
|
||||
Loading…
Add table
Add a link
Reference in a new issue