ddci-core 0.2.0.2 → 0.2.1.1
raw patch · 6 files changed
+41/−54 lines, 6 filesdep ~ddc-basedep ~ddc-coredep ~ddc-core-eval
Dependency ranges changed: ddc-base, ddc-core, ddc-core-eval, ddc-core-simpl
Files
- DDCI/Core/Command/Check.hs +12/−36
- DDCI/Core/Command/Eval.hs +9/−7
- DDCI/Core/Command/Help.hs +1/−1
- LICENSE +11/−1
- Main.hs +1/−1
- ddci-core.cabal +7/−8
DDCI/Core/Command/Check.hs view
@@ -18,13 +18,11 @@ import DDC.Core.Pretty import DDC.Core.Parser import DDC.Core.Parser.Tokens-import DDC.Core.Collect import DDC.Core.Transform.SpreadX import DDC.Type.Transform.SpreadT import qualified DDC.Type.Parser as T import qualified DDC.Type.Check as T import qualified DDC.Base.Parser as BP-import qualified Data.Set as Set -- kind ------------------------------------------------------------------------@@ -39,7 +37,7 @@ Right t -> goCheck t goCheck t- = case T.checkType primKindEnv (spreadT primKindEnv t) of+ = case T.checkType primDataDefs primKindEnv (spreadT primKindEnv t) of Left err -> putStrLn $ renderIndent $ ppr err Right k -> outDocLn state $ ppr t <+> text "::" <+> ppr k @@ -67,7 +65,7 @@ else return () checkT t- = case T.checkType primKindEnv (spreadT primKindEnv t) of+ = case T.checkType primDataDefs primKindEnv (spreadT primKindEnv t) of Left err -> do putStrLn $ renderIndent $ ppr err return False@@ -99,7 +97,7 @@ -> String -> IO (Maybe (Witness Name, Type Name)) -cmdParseCheckWitness state lineStart str+cmdParseCheckWitness _state lineStart str = goParse (lexString lineStart str) where -- Lex and parse the string.@@ -109,28 +107,16 @@ -> do putStrLn $ renderIndent $ text "parse error " <> ppr err return Nothing - Right x -> goCheck x+ Right x -> goCheck (spreadX primKindEnv primTypeEnv x) - -- Spread type annotations into binders,- -- check for undefined variables, - -- and check its type. goCheck x- = let fvs = freeX primTypeEnv x -- TODO: also check for free type vars- x' = spreadX primKindEnv primTypeEnv x- in if Set.null fvs- then goResult x' (checkWitness primKindEnv primTypeEnv x')- else do - outDocLn state $ text "Undefined variables: " <> ppr fvs- return Nothing-- -- Expression had a type error.- goResult _ (Left err)- = do putStrLn $ renderIndent $ ppr err- return Nothing- - goResult x (Right t)- = return $ Just (x, t)+ = case checkWitness primDataDefs primKindEnv primTypeEnv x of+ Left err+ -> do putStrLn $ renderIndent $ ppr err+ return Nothing + Right t+ -> return $ Just (x, t) -- check / type / effect / closure --------------------------------------------@@ -193,7 +179,7 @@ -> IO (Maybe ( Exp () Name , Type Name, Effect Name, Closure Name)) -cmdParseCheckExp state lineStart str+cmdParseCheckExp _state lineStart str = goParse (lexString lineStart str) where -- Lex and parse the string.@@ -203,17 +189,7 @@ -> do putStrLn $ renderIndent $ ppr err return Nothing - Right x -> goCheckVars x-- -- Check for undefined variables, and spread type annotations into- -- bound occurrences of variables.- goCheckVars x- = let fvs = freeX primTypeEnv x -- TODO also check for free type vars- x' = spreadX primKindEnv primTypeEnv x- in if Set.null fvs- then goCheckType x'- else do outDocLn state $ text "Undefined variables: " <> ppr fvs- return Nothing+ Right x -> goCheckType (spreadX primKindEnv primTypeEnv x) -- Check the type of the expression. goCheckType x
DDCI/Core/Command/Eval.hs view
@@ -98,18 +98,20 @@ -- Decide what new region should be allocated first. -- Region 0 is reserved for thunks.- iFirstAlloc+ iAllocBump | _ : _ <- rs , Rgn iR <- maximum rs- = iR + 1+ = iR | otherwise- = 1+ = 0 - in Store.empty - { Store.storeNextRgn = iFirstAlloc - , Store.storeRegions = Set.fromList (Rgn 0 : rs)- , Store.storeGlobal = Set.fromList (Rgn 0 : rs) }+ store = Store.initial++ in store+ { Store.storeNextRgn = Store.storeNextRgn store + iAllocBump+ , Store.storeRegions = Store.storeRegions store `Set.union` Set.fromList rs+ , Store.storeGlobal = Store.storeGlobal store `Set.union` Set.fromList rs } -- | Perform a single step of evaluation and print what happened.
DDCI/Core/Command/Help.hs view
@@ -37,7 +37,7 @@ , " :trans EXP Transform the given expression." , " :trun EXP Transform the given expression then evaluate it." , ""- , " TRANS ::= None | Anonymize | Beta"+ , " TRANS ::= None | Anonymize | ANormal | Beta" , "" ]
LICENSE view
@@ -1,7 +1,8 @@ -------------------------------------------------------------------------------- The Disciplined Disciple Compiler License (MIT style) -Copyright (c) 2008-2011 Benjamin Lippmeier+Copyrite (K) 2007-2012 The Disciplined Disciple Compiler Strike Force+All rights reversed. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal@@ -12,6 +13,15 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++-------------------------------------------------------------------------------+Under Australian law copyright is free and automatic.+By contributing to DDC authors grant all rights they have regarding their+contributions to the other members of the Disciplined Disciple Compiler Strike+Force, past, present and future, as well as placing their contributions under+the above license.++Use "darcs show authors" to get a list of Strike Force members. -------------------------------------------------------------------------------- Redistributions of libraries in ./external are governed by their own licenses:
Main.hs view
@@ -127,7 +127,7 @@ -- | Run an interactive session runInteractive :: IO () runInteractive- = do putStrLn "DDCi-core, version 0.2.0: http://disciple.ouroborus.net. :? for help"+ = do putStrLn "DDCi-core, version 0.2.1: http://disciple.ouroborus.net. :? for help" -- Setup terminal mode. loopInteractive
ddci-core.cabal view
@@ -1,9 +1,9 @@ Name: ddci-core-Version: 0.2.0.2+Version: 0.2.1.1 License: MIT License-file: LICENSE-Author: Ben Lippmeier-Maintainer: benl@ouroborus.net+Author: The Disciplined Disciple Compiler Strike Force+Maintainer: Ben Lippmeier <benl@ouroborus.net> Build-Type: Simple Cabal-Version: >=1.6 Stability: experimental@@ -26,10 +26,10 @@ containers == 0.4.*, haskeline == 0.6.4.*, haskell-src-exts== 1.*,- ddc-base == 0.2.0.*,- ddc-core == 0.2.0.*,- ddc-core-eval == 0.2.0.*,- ddc-core-simpl == 0.2.0.*+ ddc-base == 0.2.1.*,+ ddc-core == 0.2.1.*,+ ddc-core-eval == 0.2.1.*,+ ddc-core-simpl == 0.2.1.* Main-is: Main.hs@@ -53,6 +53,5 @@ FlexibleContexts ghc-options:- -Wall -fno-warn-missing-signatures -fno-warn-unused-do-bind