10import qualified Data.Map as Map
12import qualified AST.Module.Name as ModuleName
13import qualified Elm.Name as N
21 = Lambda Type Type [Type]
28 | Type ModuleName.Canonical N.Name [Type]
29 | Record (Map.Map N.Name Type) Extension
31 | Tuple Type Type (Maybe Type)
32 | Alias ModuleName.Canonical N.Name [(N.Name, Type)] Type
41iteratedDealias :: Type -> Type
44 Alias _ _ _ realType ->
45 iteratedDealias realType
55type Localizer = Map.Map N.Name ()
73detectMissingArgs :: Type -> Type -> Maybe (Type, [Type])
74detectMissingArgs actual expected =
75 detectMissingArgsHelp (reverseArgs actual) (reverseArgs expected)
78detectMissingArgsHelp :: [Type] -> [Type] -> Maybe (Type, [Type])
79detectMissingArgsHelp actuals expecteds =
80 case (actuals, expecteds) of
81 (x:xs, y:ys) -> if isMatchy x y then detectMissingArgsHelp xs ys else Nothing
82 (x:xs, []) -> Just (x, xs)
87reverseArgs :: Type -> [Type]
90 Lambda a b cs -> reverse (a:b:cs)
96 RigidSuper _ -> [tipe]
100 Tuple _ _ _ -> [tipe]
101 Alias _ _ _ t -> reverseArgs t
104isMatchy :: Type -> Type -> Bool
107 (Lambda a b cs, Lambda x y zs) ->
108 isMatchy a x && isMatchy b y && length cs == length zs && and (zipWith isMatchy cs zs)
110 (Infinite, Infinite) ->
122 (FlexSuper x, FlexSuper y) ->
125 (RigidVar x, RigidVar y) ->
128 (RigidSuper x, RigidSuper y) ->
131 (Type home1 name1 args1, Type home2 name2 args2) ->
132 home1 == home2 && name1 == name2 && and (zipWith isMatchy args1 args2)
134 (Record fields1 ext1, Record fields2 ext2) ->
136 (Map.size (Map.difference fields1 fields2))
137 (Map.intersectionWith isMatchy fields1 fields2)
138 (Map.size (Map.difference fields2 fields1))
143 (Tuple a b Nothing, Tuple x y Nothing) ->
144 isMatchy a x && isMatchy b y
146 (Tuple a b (Just c), Tuple x y (Just z)) ->
147 isMatchy a x && isMatchy b y && isMatchy c z
149 (Alias _ _ _ alias1, tipe2) ->
150 isMatchy alias1 tipe2
152 (tipe1, Alias _ _ _ alias2) ->
153 isMatchy tipe1 alias2
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list