Simplify CheckKinds implementation using recursion

This commit is contained in:
Scott Olsen 2020-05-05 22:52:03 -04:00
parent deb1ecd51a
commit 7fc8a6ab2e

View File

@ -307,10 +307,10 @@ areUnifiable a b | a == b = True
checkKinds :: Ty -> Ty -> Bool
-- Base < Higher
checkKinds (FuncTy argTysA retTyA _) (FuncTy argTysB retTyB _) =
let argKinds = zipWith (<=) (map tyToKind argTysA) (map tyToKind argTysB)
let argKinds = zipWith checkKinds argTysA argTysB
retKinds = tyToKind retTyA <= tyToKind retTyB
in all (== True) (retKinds : argKinds)
checkKinds t t' = tyToKind t == tyToKind t'
checkKinds t t' = tyToKind t <= tyToKind t'
-- | Put concrete types into the places where there are type variables.
-- For example (Fn [a] b) => (Fn [Int] Bool)