@@ -507,16 +507,44 @@ constrainDef env info (Canonical.Def _ (A.A patternRegion pattern) expr maybeTip
507 let qs = [] -- should come from the def, but I'm not sure what would live there...
507 let qs = [] -- should come from the def, but I'm not sure what would live there...
509 case (pattern, maybeTipe) of
509 case (pattern, maybeTipe) of
510− (P.Var name, Just (A.A typeRegion tipe)) ->
511− constrainAnnotatedDef env info qs patternRegion typeRegion name expr tipe
513 (P.Var name, Nothing) ->
510 (P.Var name, Nothing) ->
514 constrainUnannotatedDef env info qs patternRegion name expr
511 constrainUnannotatedDef env info qs patternRegion name expr
513+ (P.Var name, Just (A.A typeRegion tipe)) ->
514+ constrainAnnotatedDef env info qs patternRegion typeRegion name expr tipe
517 error "canonical definitions must not have complex patterns as names in the contstraint generation phase"
517 error "canonical definitions must not have complex patterns as names in the contstraint generation phase"
520+constrainUnannotatedDef
528+constrainUnannotatedDef env info qs patternRegion name expr =
529+ do -- Some mistake may be happening here. Currently, qs is always [].
530+ rigidVars <- mapM mkRigid qs
536+ let env' = Env.addValues env (zip qs rigidVars)
538+ con <- constrain env' expr tipe
541+ { iRigid = rigidVars ++ iRigid info
542+ , iFlex = v : iFlex info
543+ , iHeaders = Map.insert name (A.A patternRegion tipe) (iHeaders info)
544+ , iC2 = con /\ iC2 info
520constrainAnnotatedDef
548constrainAnnotatedDef
521 :: Env.Environment
549 :: Env.Environment
@@ -554,31 +582,3 @@ constrainAnnotatedDef env info qs patternRegion typeRegion name expr tipe =
554 { iSchemes = scheme : iSchemes info
582 { iSchemes = scheme : iSchemes info
555 , iC1 = iC1 info /\ ex [var] (defCon /\ fl rigidVars annCon)
583 , iC1 = iC1 info /\ ex [var] (defCon /\ fl rigidVars annCon)
559−constrainUnannotatedDef
567−constrainUnannotatedDef env info qs patternRegion name expr =
568− do -- Some mistake may be happening here. Currently, qs is always [].
569− rigidVars <- mapM mkRigid qs
575− let env' = Env.addValues env (zip qs rigidVars)
577− con <- constrain env' expr tipe
580− { iRigid = rigidVars ++ iRigid info
581− , iFlex = v : iFlex info
582− , iHeaders = Map.insert name (A.A patternRegion tipe) (iHeaders info)
583− , iC2 = con /\ iC2 info