Skip to content

Commit

Permalink
Fix the latest incarnation of #22
Browse files Browse the repository at this point in the history
  • Loading branch information
liamoc authored and Zilin Chen committed Mar 6, 2018
1 parent d4dddfd commit 9d50913
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cogent/src/Cogent/TypeCheck/Subst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import Prelude hiding (lookup)
newtype Subst = Subst (M.IntMap TCType)

lookup :: Subst -> Int -> TCType
lookup (Subst m) i = fromMaybe (U i) (M.lookup i m)
lookup s@(Subst m) i = maybe (U i) (apply s) (M.lookup i m)

instance Monoid Subst where
mempty = Subst M.empty
mappend a@(Subst a') b@(Subst b')
= Subst (fmap (apply b) a' <> fmap (apply a) b')
= Subst (a' <> b')

apply :: Subst -> TCType -> TCType
apply = forFlexes . lookup
Expand Down

0 comments on commit 9d50913

Please sign in to comment.