mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-04 19:26:10 +03:00
Simplify CheckKinds implementation using recursion
This commit is contained in:
parent
deb1ecd51a
commit
7fc8a6ab2e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user