1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Canonicalize.Type
9import qualified Data.Map as Map
11import qualified AST.Type as Type
12import qualified Canonicalize.Environment.Dups as Dups
13import qualified Canonicalize.Environment.Internals as Env
14import qualified Reporting.Annotation as A
15import qualified Reporting.Result as Result
22canonicalize :: Env.Env -> Type.Raw -> Env.Result Type.Canonical
23canonicalize env (A.A _ tipe) =
26 Result.ok (Type.Var x)
28 Type.RType region maybePrefix name args ->
29 do info <- Env.findType region env maybePrefix name (length args)
30 cargs <- traverse (canonicalize env) args
33 Env.Alias home argNames aliasedType ->
34 Type.Aliased home name (zip argNames cargs) (Type.Holey aliasedType)
37 Type.Type home name cargs
41 <$> canonicalize env a
42 <*> canonicalize env b
44 Type.RRecord fields ext ->
45 do fieldDict <- Dups.checkFields fields
47 <$> Map.traverseWithKey (\_ t -> canonicalize env t) fieldDict
48 <*> traverse (canonicalize env) ext
55 <$> canonicalize env a
56 <*> canonicalize env b
57 <*> traverse (canonicalize env) cs
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