more Justfile command and fixed bug in Monomorphizer
This commit is contained in:
parent
23f4e3365a
commit
d3d2c61dc6
3 changed files with 13 additions and 4 deletions
8
Justfile
8
Justfile
|
|
@ -32,4 +32,10 @@ hmdm FILE:
|
||||||
cabal run language -- -d -t hm -m {{FILE}}
|
cabal run language -- -d -t hm -m {{FILE}}
|
||||||
|
|
||||||
bidm FILE:
|
bidm FILE:
|
||||||
cabal run language -- -d -t bi -m {{FILE}}
|
cabal run language -- -d -t bi -m {{FILE}}
|
||||||
|
|
||||||
|
hmp FILE:
|
||||||
|
cabal run language -- -t hm -d -p {{FILE}}
|
||||||
|
|
||||||
|
bip FILE:
|
||||||
|
cabal run language -- -t bi -p {{FILE}}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ disableGC :: Options -> Options
|
||||||
disableGC opts = opts{gc = False}
|
disableGC opts = opts{gc = False}
|
||||||
|
|
||||||
disablePrelude :: Options -> Options
|
disablePrelude :: Options -> Options
|
||||||
disablePrelude opts = opts{preludeOpt = False}
|
disablePrelude opts = opts{preludeOpt = True}
|
||||||
|
|
||||||
chooseTypechecker :: String -> Options -> Options
|
chooseTypechecker :: String -> Options -> Options
|
||||||
chooseTypechecker s options = options{typechecker = tc}
|
chooseTypechecker s options = options{typechecker = tc}
|
||||||
|
|
@ -212,6 +212,6 @@ prelude =
|
||||||
, " Cons x xs => flipConst (printChar x) (printStr xs)"
|
, " Cons x xs => flipConst (printChar x) (printStr xs)"
|
||||||
, "\n"
|
, "\n"
|
||||||
, "data List a where"
|
, "data List a where"
|
||||||
, " Cons : a -> List a -> List a"
|
|
||||||
, " Nil : List a"
|
, " Nil : List a"
|
||||||
|
, " Cons : a -> List a -> List a"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ import qualified LambdaLifterIr as L
|
||||||
|
|
||||||
import Data.Maybe (fromJust, catMaybes)
|
import Data.Maybe (fromJust, catMaybes)
|
||||||
import Data.Tuple.Extra (secondM)
|
import Data.Tuple.Extra (secondM)
|
||||||
|
import Debug.Trace (trace)
|
||||||
|
import Test.QuickCheck.State (State(expected))
|
||||||
|
|
||||||
{- | EnvM is the monad containing the read-only state as well as the
|
{- | EnvM is the monad containing the read-only state as well as the
|
||||||
output state containing monomorphized functions and to-be monomorphized
|
output state containing monomorphized functions and to-be monomorphized
|
||||||
|
|
@ -343,7 +345,8 @@ morphPattern p expectedType = case p of
|
||||||
return $ Just ((M.PEnum newIdent, expectedType), Set.empty)
|
return $ Just ((M.PEnum newIdent, expectedType), Set.empty)
|
||||||
L.PInj ident pts -> do let newIdent = newName expectedType ident
|
L.PInj ident pts -> do let newIdent = newName expectedType ident
|
||||||
ts' <- mapM (getMonoFromPoly . snd) pts
|
ts' <- mapM (getMonoFromPoly . snd) pts
|
||||||
morphCons (convertConsTypeToDataType expectedType ts') ident newIdent
|
trace ("Constructor: " ++ show ident ++ "expected: " ++ show expectedType ++ "\nTS': " ++ show ts' ++ "\n\n\n") pure ()
|
||||||
|
morphCons (convertConsTypeToDataType expectedType (reverse ts')) ident newIdent
|
||||||
let pts' = zip (map fst pts) ts'
|
let pts' = zip (map fst pts) ts'
|
||||||
psSets <- mapM (uncurry morphPattern) pts'
|
psSets <- mapM (uncurry morphPattern) pts'
|
||||||
let maybePsSets = sequence psSets
|
let maybePsSets = sequence psSets
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue