*R functions

This commit is contained in:
crumbtoo
2024-02-01 10:37:51 -07:00
parent 1803a1e058
commit 46f0393a03
5 changed files with 52 additions and 34 deletions

View File

@@ -17,6 +17,7 @@ module Core.Parse
import Control.Monad ((>=>))
import Data.Foldable (foldl')
import Data.Functor.Identity
import Core.Syntax
import Core.Lex
import Compiler.RLPC
@@ -224,8 +225,11 @@ insScDef sc = programScDefs %~ (sc:)
singletonScDef :: (Hashable b) => ScDef b -> Program b
singletonScDef sc = insScDef sc mempty
parseCoreProgR :: [Located CoreToken] -> RLPC Program'
parseCoreProgR = parseCoreProg
parseCoreProgR :: forall m. (Applicative m) => [Located CoreToken] -> RLPCT m Program'
parseCoreProgR = hoistRlpcT generalise . parseCoreProg
where
generalise :: forall a. Identity a -> m a
generalise (Identity a) = pure a
happyBind :: RLPC a -> (a -> RLPC b) -> RLPC b
happyBind m k = m >>= k