mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-05 14:17:33 +03:00
remove debugging statements
This commit is contained in:
parent
58b9b37573
commit
26f06a644a
@ -11,7 +11,7 @@
|
||||
|
||||
module Unison.Type where
|
||||
|
||||
import Debug.Trace
|
||||
-- import Debug.Trace
|
||||
import Control.Monad (join)
|
||||
import Data.Functor.Identity (runIdentity)
|
||||
import Data.Functor.Const (Const(..), getConst)
|
||||
@ -365,7 +365,6 @@ generalize t = foldr (forall (ABT.annotation t)) t $ Set.toList (ABT.freeVars t)
|
||||
-- we leave the signature alone as it's unclear what transformation the user might
|
||||
-- want. The user is responsible for using effect variables as they wish.
|
||||
generalizeEffects :: forall v a . Var v => Int -> AnnotatedType v a -> AnnotatedType v a
|
||||
generalizeEffects arity t | traceShow ("generalizeEffects"::String, arity, t) False = undefined
|
||||
generalizeEffects _arity t | usesEffects t = t
|
||||
generalizeEffects arity t =
|
||||
let
|
||||
@ -387,7 +386,7 @@ generalizeEffects arity t =
|
||||
t' = go (arity - 1) t
|
||||
tr = if Set.member e (ABT.freeVars t') then forall at e t'
|
||||
else t'
|
||||
in traceShow ("generalizeEffects"::String, arity, tr) tr
|
||||
in tr
|
||||
|
||||
usesEffects :: Var v => AnnotatedType v a -> Bool
|
||||
usesEffects t = getAny . getConst $ ABT.visit go t where
|
||||
|
@ -671,7 +671,6 @@ synthesize e = scope (InSynthesize e) $ do
|
||||
body <- pure $ ABT.bindInheritAnnotation body (Term.var() arg)
|
||||
withEffects0 [et] $ check body ot
|
||||
ctx <- getContext
|
||||
traceM $ "et = " ++ show (apply ctx et)
|
||||
pure $ Type.arrow l it (Type.effect l (apply ctx <$> [et]) ot)
|
||||
go (Term.LetRecNamed' [] body) = synthesize body
|
||||
go (Term.LetRec' letrec) = do
|
||||
@ -868,11 +867,7 @@ annotateLetRecBindings letrec = do
|
||||
bindingArities = Term.arity . snd <$> bindings
|
||||
appendContext $ context (Marker e1 : map existential es ++ zipWith Ann vs bindingTypes)
|
||||
-- check each `bi` against `ei`; sequencing resulting contexts
|
||||
Foldable.for_ (zip bindings bindingTypes) $ \((_,b), t) -> do
|
||||
traceM "starting binding check"
|
||||
check b t
|
||||
t2 <- applyM t
|
||||
traceM $ "t = " ++ show t2
|
||||
Foldable.for_ (zip bindings bindingTypes) $ \((_,b), t) -> check b t
|
||||
-- compute generalized types `gt1, gt2 ...` for each binding `b1, b2...`;
|
||||
-- add annotations `v1 : gt1, v2 : gt2 ...` to the context
|
||||
(_, _, ctx2) <- breakAt (Marker e1) <$> getContext
|
||||
@ -978,7 +973,7 @@ check e0 t0 = scope (InCheck e0 t0) $ do
|
||||
-- | `subtype ctx t1 t2` returns successfully if `t1` is a subtype of `t2`.
|
||||
-- This may have the effect of altering the context.
|
||||
subtype :: forall v loc . (Var v, Ord loc) => Type v loc -> Type v loc -> M v loc ()
|
||||
subtype tx ty | True && traceShow ("subtype"::String, tx, ty) False = undefined
|
||||
subtype tx ty | debugEnabled && traceShow ("subtype"::String, tx, ty) False = undefined
|
||||
subtype tx ty = scope (InSubtype tx ty) $
|
||||
do ctx <- getContext; go (ctx :: Context v loc) tx ty
|
||||
where -- Rules from figure 9
|
||||
@ -1042,7 +1037,7 @@ subtype tx ty = scope (InSubtype tx ty) $
|
||||
-- a subtype of the given type, updating the context
|
||||
-- in the process.
|
||||
instantiateL :: (Var v, Ord loc) => B.Blank loc -> v -> Type v loc -> M v loc ()
|
||||
instantiateL _ v t | True && traceShow ("instantiateL"::String, v, t) False = undefined
|
||||
instantiateL _ v t | debugEnabled && traceShow ("instantiateL"::String, v, t) False = undefined
|
||||
instantiateL blank v t = scope (InInstantiateL v t) $ do
|
||||
getContext >>= \ctx -> case Type.monotype t >>= solve ctx v of
|
||||
Just ctx -> setContext ctx -- InstLSolve
|
||||
@ -1099,7 +1094,7 @@ instantiateL blank v t = scope (InInstantiateL v t) $ do
|
||||
-- a supertype of the given type, updating the context
|
||||
-- in the process.
|
||||
instantiateR :: (Var v, Ord loc) => Type v loc -> B.Blank loc -> v -> M v loc ()
|
||||
instantiateR t _ v | True && traceShow ("instantiateR"::String, t, v) False = undefined
|
||||
instantiateR t _ v | debugEnabled && traceShow ("instantiateR"::String, t, v) False = undefined
|
||||
instantiateR t blank v = scope (InInstantiateR t v) $
|
||||
getContext >>= \ctx -> case Type.monotype t >>= solve ctx v of
|
||||
Just ctx -> setContext ctx -- InstRSolve
|
||||
|
Loading…
Reference in New Issue
Block a user