parse/unparse test

This commit is contained in:
crumbtoo
2023-12-29 21:22:26 -07:00
parent 650a4cf22f
commit d3a25742f1
4 changed files with 45 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
{-# LANGUAGE OverloadedStrings, LambdaCase, GeneralisedNewtypeDeriving #-}
module CoreSyntax
( ProgramSrc(..)
, (~==)
, congruentSrc
, unparseCoreProg
)
@@ -203,12 +202,8 @@ ws1 = elements [" ", " "]
-- | Two bodies of source code are considered congruent iff the parser produces
-- identical ASTs for both.
(~==) :: ProgramSrc -> ProgramSrc -> Bool
(~==) = (==) `on` (justParseSrc . T.unpack . coerce)
-- | Prefix synonym for @(~==)@
congruentSrc :: ProgramSrc -> ProgramSrc -> Bool
congruentSrc = (~==)
congruentSrc = (==) `on` (justParseSrc . T.unpack . coerce)
----------------------------------------------------------------------------------