Skip to content

Commit

Permalink
BinderKindLet: Add Stored lam inside it
Browse files Browse the repository at this point in the history
  • Loading branch information
Peaker committed Feb 2, 2016
1 parent 1d57377 commit a46333c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Lamdu/Sugar/Convert/Binder.hs
Expand Up @@ -91,7 +91,7 @@ convertRedex ::
convertRedex expr redex =
do
value <-
convertBinder BinderKindLet defGuid (redexArg redex)
convertBinder binderKind defGuid (redexArg redex)
& localNewExtractDestPos expr
actions <-
mkLetIActions (expr ^. V.payload . Input.stored)
Expand All @@ -118,6 +118,10 @@ convertRedex expr redex =
, _lUsages = redexParamRefs redex
}
where
binderKind =
redexLam redex
<&> Lens.mapped %~ (^. Input.stored)
& BinderKindLet
V.Lam param body = redexLam redex
defGuid = UniqueId.toGuid param
defEntityId = EntityId.ofLambdaParam param
Expand Down
10 changes: 5 additions & 5 deletions Lamdu/Sugar/Convert/Binder/Params.hs
Expand Up @@ -158,7 +158,7 @@ makeAddFieldParam binderKind mkNewTags storedLam =
BinderKindDef defI ->
changeRecursiveCallArgs addFieldToCall
(storedLam ^. slLam . V.lamResult) defI
BinderKindLet -> return ()
BinderKindLet _ -> return ()
BinderKindLambda -> return ()
void $ wrapOnError $ slLambdaProp storedLam
ParamAddResultNewTag tagG & return
Expand Down Expand Up @@ -237,7 +237,7 @@ makeDelFieldParam binderKind tags fp storedLam =
BinderKindDef defI ->
changeRecursiveCallArgs fixRecurseArg
(storedLam ^. slLam . V.lamResult) defI
BinderKindLet -> return ()
BinderKindLet _ -> return ()
BinderKindLambda -> return ()
_ <- wrapOnError $ slLambdaProp storedLam
return delResult
Expand Down Expand Up @@ -374,7 +374,7 @@ makeDeleteLambda binderKind (StoredLam (V.Lam paramVar lamBodyStored) lambdaProp
BinderKindDef defI ->
changeRecursionsFromCalls defI lamBodyStored
BinderKindLambda -> return ()
BinderKindLet -> return ()
BinderKindLet _ -> return ()
let lamBodyI = Property.value (lamBodyStored ^. V.payload)
_ <- protectedSetToVal lambdaProp lamBodyI
return ParamDelResultDelVar
Expand Down Expand Up @@ -439,7 +439,7 @@ makeConvertToRecordParams binderKind storedLam =
changeRecursiveCallArgs
(wrapArgWithRecord varToTags)
(storedLam ^. slLam . V.lamResult) defI
BinderKindLet -> return ()
BinderKindLet _ -> return ()
BinderKindLambda -> return ()
_ <- wrapOnError (slLambdaProp storedLam)
ParamAddResultVarToTags varToTags & return
Expand Down Expand Up @@ -611,7 +611,7 @@ convertEmptyParams binderKind val =
(newParam, dst) <- DataOps.lambdaWrap (storedVal ^. V.payload)
case binderKind of
BinderKindDef defI -> changeRecursionsToCalls defI storedVal
BinderKindLet -> return ()
BinderKindLet _ -> return ()
BinderKindLambda -> return ()
void $ protectedSetToVal (storedVal ^. V.payload) dst
return $
Expand Down
7 changes: 4 additions & 3 deletions Lamdu/Sugar/Convert/Binder/Types.hs
Expand Up @@ -2,9 +2,10 @@ module Lamdu.Sugar.Convert.Binder.Types
( BinderKind(..)
) where

import Lamdu.Expr.IRef (DefI)
import Lamdu.Expr.IRef (DefI, ValIProperty)
import qualified Lamdu.Expr.Val as V

data BinderKind m
= BinderKindDef (DefI m)
| BinderKindLet
= BinderKindDef (DefI m) -- TODO: Top-level defs to fix
| BinderKindLet (V.Lam (V.Val (ValIProperty m)))
| BinderKindLambda

0 comments on commit a46333c

Please sign in to comment.