replacing known values in output now (pretty sick)

This commit is contained in:
jackjohn7 2026-05-17 00:21:54 -05:00
parent 9d209fee17
commit 3046beaef2
6 changed files with 276 additions and 7 deletions

19
test/NicetiesSpec.hs Normal file
View file

@ -0,0 +1,19 @@
module NicetiesSpec (spec) where
import Bruijn (toDeBruijn)
import Niceties (findKnown, replaceKnowns)
import Parser (Expr (Abstraction, Application, Variable))
import Test.Hspec
spec :: Spec
spec = do
describe "can find knowns" $ do
it "can find identity" $
findKnown identity `shouldBe` Just "I"
describe "replaceKnowns" $ do
it "can replace identity" $
replaceKnowns identity `shouldBe` Variable "I"
it "can replace identity of identity" $
replaceKnowns (Application identity identity) `shouldBe` Application (Variable "I") (Variable "I")
where
identity = toDeBruijn $ Abstraction "x" (Variable "x")