*R functions
This commit is contained in:
@@ -105,7 +105,7 @@ checkCoreProg p = scDefs
|
||||
where scname = sc ^. _lhs._1
|
||||
|
||||
-- | @checkCoreProgR p@ returns @p@ if @p@ successfully typechecks.
|
||||
checkCoreProgR :: Program' -> RLPC Program'
|
||||
checkCoreProgR :: (Applicative m) => Program' -> RLPCT m Program'
|
||||
checkCoreProgR p = undefined
|
||||
|
||||
{-# WARNING checkCoreProgR "unimpl" #-}
|
||||
|
||||
@@ -20,6 +20,7 @@ import Debug.Trace
|
||||
import Data.Text (Text)
|
||||
import Data.Text qualified as T
|
||||
import Data.String (IsString(..))
|
||||
import Data.Functor.Identity
|
||||
import Core.Syntax
|
||||
import Compiler.RLPC
|
||||
-- TODO: unify Located definitions
|
||||
@@ -180,8 +181,11 @@ lexCore s = case m of
|
||||
where
|
||||
m = runAlex s lexStream
|
||||
|
||||
lexCoreR :: Text -> RLPC [Located CoreToken]
|
||||
lexCoreR = lexCore
|
||||
lexCoreR :: forall m. (Applicative m) => Text -> RLPCT m [Located CoreToken]
|
||||
lexCoreR = hoistRlpcT generalise . lexCore
|
||||
where
|
||||
generalise :: forall a. Identity a -> m a
|
||||
generalise (Identity a) = pure a
|
||||
|
||||
-- | @lexCore@, but the tokens are stripped of location info. Useful for
|
||||
-- debugging
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user