Commit 9ee2586a0c332a392303d1824428fa420b914dfc

  • avatar
  • Ville Tirronen <ville.tirronen @j…u.fi> (Committer)
  • Wed Aug 22 15:51:08 EEST 2018
  • avatar
  • Ville Tirronen <ville.tirronen @j…u.fi> (Author)
  • Wed Aug 22 15:51:08 EEST 2018
WIP
DerivationChecker/elms/TypeGUI.elm
(2 / 7)
  
187187 )
188188 in case renderState.currentAnnotation of
189189 Nothing -> fragAnnotation
190 Just sta -> if (addr == getAddr sta || addr == getAddrB sta) && (not renderState.underAnnotation)
190 Just sta -> if (addr == getAddr sta) && (not renderState.underAnnotation)
191191 then if renderState.editable
192192 then exprBox [class "activeFragment"] (Active sta)
193193 else fragAnnotation
256256makeSTA : T.Addr -> String -> T.SerializedTypeAnnotation String
257257makeSTA addr = T.STA (addrExprNum addr) (addrToTarget addr)
258258
259getAddrB : T.SerializedTypeAnnotation a -> T.Addr
260getAddrB sta = case sta of
261 (T.STA n T.Expr _) -> T.NonSelectable n
262 (T.STA n (T.Binding m) _) -> T.BinderNOf n m
263 (T.STA n (T.InfixOp) _) -> T.InfixOperatorOf n
264
265259getAddr : T.SerializedTypeAnnotation a -> T.Addr
266260getAddr sta = case sta of
267261 (T.STA n T.Expr _) -> T.Number n
262 (T.STA n T.NonSel _) -> T.NonSelectable n
268263 (T.STA n (T.Binding m) _) -> T.BinderNOf n m
269264 (T.STA n (T.InfixOp) _) -> T.InfixOperatorOf n
270265
DerivationChecker/src/Typing.hs
(5 / 2)
  
6868--
6969-- == Needs (Minimum) ==
7070-- Testing!
71-- Need to fix the NonSelectable issue! It can't be part of the address. Things will break
7172-- Proper handling of parentheses: Parenthesis autofill is broken
7273-- Renaming type variables (Big rock!)
7374-- GUI does not support renaming multiple type variables at one go (hardish)
9696 ConstraintOf String = String
9797 ConstraintOf T = Constraint T
9898
99data Target = Expr | InfixOp | Binding Integer deriving (Eq,Show,Generic)
99data Target = Expr | InfixOp | Binding Integer | NonSel deriving (Eq,Show,Generic)
100100data SerializedTypeAnnotation a = STA Integer Target a deriving (Eq,Show,Generic,Functor,Foldable,Traversable)
101101data DeductionAction c t = SetGlobal c | ModifySub [ SerializedTypeAnnotation t ] deriving (Eq,Show,Generic)
102102
223223isRename tdm (ModifySub [sta@(STA n target propT)]) = check (getSTATarget sta (typedExpr tdm))
224224 where
225225 check (Just (expr :.: tl)) = let targetPart = case target of
226 Typing.Expr -> expression tl
226 Typing.Expr -> expression tl
227 Typing.NonSel -> expression tl
227228 Typing.InfixOp -> infixOp tl
228229 Typing.Binding n -> F.foldMap Fst (Map.lookup n (binders tl))
229230 in case targetPart of
572572 Just annots -> labeleds ::: (sconcat (fmap staContent annots) <> orig) -- Oops. Last vs First issue here
573573 staContent (STA _ t a) = case t of
574574 Expr -> mempty { expression = Fst a }
575 Typing.NonSel -> mempty { expression = Fst a }
575576 Typing.InfixOp -> mempty { infixOp = Fst a }
576577 Binding i -> mempty { binders = Map.singleton i a }
577578