on master help sign in
Stop erasing binder types in executor
2aaff41David Raymond Christiansen
idris.cabal+2
@@ -690,6 +690,8 @@ Library
690 , zlib
690 , zlib
691 , optparse-applicative >= 0.8
691 , optparse-applicative >= 0.8
692 Extensions: MultiParamTypeClasses
692 Extensions: MultiParamTypeClasses
693+ , DeriveFoldable
694+ , DeriveTraversable
693 , FunctionalDependencies
695 , FunctionalDependencies
694 , FlexibleContexts
696 , FlexibleContexts
695 , FlexibleInstances
697 , FlexibleInstances
src/Idris/Core/Execute.hs+5−4
@@ -23,9 +23,10 @@ import Control.Exception
23import Control.Monad.Trans
23import Control.Monad.Trans
24import Control.Monad.Trans.State.Strict
24import Control.Monad.Trans.State.Strict
25import Control.Monad.Trans.Error
25import Control.Monad.Trans.Error
26−import Control.Monad
26+import Control.Monad hiding (forM)
27import Data.Maybe
27import Data.Maybe
28import Data.Bits
28import Data.Bits
29+import Data.Traversable (forM)
29import qualified Data.Map as M
30import qualified Data.Map as M
30
31
31#ifdef IDRIS_FFI
32#ifdef IDRIS_FFI
@@ -175,9 +176,9 @@ doExec env ctxt v@(V i) | i < length env = return (snd (env !! i))
175doExec env ctxt (Bind n (Let t v) body) = do v' <- doExec env ctxt v
176doExec env ctxt (Bind n (Let t v) body) = do v' <- doExec env ctxt v
176 doExec ((n, v'):env) ctxt body
177 doExec ((n, v'):env) ctxt body
177doExec env ctxt (Bind n (NLet t v) body) = trace "NLet" $ undefined
178doExec env ctxt (Bind n (NLet t v) body) = trace "NLet" $ undefined
178−doExec env ctxt tm@(Bind n b body) = return $
179+doExec env ctxt tm@(Bind n b body) = do b' <- forM b (doExec env ctxt)
179− EBind n (fmap (\_->EErased) b)
180+ return $
180− (\arg -> doExec ((n, arg):env) ctxt body)
181+ EBind n b' (\arg -> doExec ((n, arg):env) ctxt body)
181doExec env ctxt a@(App _ _) =
182doExec env ctxt a@(App _ _) =
182 do let (f, args) = unApply a
183 do let (f, args) = unApply a
183 f' <- doExec env ctxt f
184 f' <- doExec env ctxt f
src/Idris/Core/TT.hs+3−1
@@ -31,6 +31,8 @@ import Numeric (showIntAtBase)
31import qualified Data.Text as T
31import qualified Data.Text as T
32import Data.List
32import Data.List
33import Data.Maybe (listToMaybe)
33import Data.Maybe (listToMaybe)
34+import Data.Foldable (Foldable)
35+import Data.Traversable (Traversable)
34import Data.Vector.Unboxed (Vector)
36import Data.Vector.Unboxed (Vector)
35import qualified Data.Vector.Unboxed as V
37import qualified Data.Vector.Unboxed as V
36import qualified Data.Binary as B
38import qualified Data.Binary as B
@@ -638,7 +640,7 @@ data Binder b = Lam { binderTy :: !b {-^ type annotation for bound variable-}
638 | PVar { binderTy :: !b }
640 | PVar { binderTy :: !b }
639 -- ^ A pattern variable
641 -- ^ A pattern variable
640 | PVTy { binderTy :: !b }
642 | PVTy { binderTy :: !b }
641− deriving (Show, Eq, Ord, Functor)
643+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable)
642{-!
644{-!
643deriving instance Binary Binder
645deriving instance Binary Binder
644deriving instance NFData Binder
646deriving instance NFData Binder