unify p t1 t2
    | t1 == t2 = success t1
    | otherwise = unificationError p t1 t2
  where
    unificationError s t1 t2 = failure (Err s e)
        where
          e = ErrorUnification (UnificationError t1 t2)

-- * Type-checker

-- |Run the type checker.
unify p t1 t2
    | t1 == t2 = success t1
    | otherwise = unificationError p t1 t2
  where
    unificationError s t1 t2 = failure (Err s e)
        where
          e = ErrorUnification (UnificationError t1 t2)

-- * Type-checker

-- |Run the type checker.
unify p t1 t2
    | t1 == t2 = success t1
    | otherwise = unificationError p t1 t2
  where
    unificationError s t1 t2 = failure (Err s e)
        where
          e = ErrorUnification (UnificationError t1 t2)

-- * Type-checker

-- |Run the type checker.