-
Notifications
You must be signed in to change notification settings - Fork 9
/
refactor.plan
73 lines (58 loc) · 3.11 KB
/
refactor.plan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
goals:
simple, clean API and dependency tree
stage 1:
typesig - LambdaCube.Compiler.Utils
import LambdaCube.Compiler.Pretty
import LambdaCube.Compiler.DeBruijn
typesig - import LambdaCube.Compiler.Lexer
typesig - import LambdaCube.Compiler.DesugaredSource
typesig - import LambdaCube.Compiler.Patterns
typesig - import LambdaCube.Compiler.Statements
typesig - import LambdaCube.Compiler.Parser
stage 2:
import LambdaCube.Compiler.Core
import LambdaCube.Compiler.Infer
import LambdaCube.Compiler.InferMonad
stage 3:
import LambdaCube.Compiler.CoreToIR
IDEA:
add each module a Pattern module with the pattern synonyms that provides the rich API
problem:
low level use of debruijn indices
too many and indiscpilined pattern synonyms
type classes:
Debruijn: Rearrange, HasFreeVars, DeBruijnify
Pretty: PShow
Patterns: PatVars
DesugaredSource: SourceInfo, SetSourceInfo
Core: HasFName, Subst, MkDoc, NType
data types:
Lexer: ParseEnv, Namespace
Parser: LCParseError, ParseWarning, DesugarInfo
Pretty: Fixity, Doc, DocAtom
Patterns: ParseCheck, Pat_ c, ParPat_ c, Lets a, GuardTree
DesugaredSource: FileInfo, Range, SI, SIName, FNameTag, Lit, SExp' a, Binder, Visibility, Stmt, Module_ a, Export, ImportItems, Extension
Utils: Void
Statements: PreStmt, StmtNode
Infer: CEnv, Env
InferMonad: ErrorMsg, Info
Core: ConName, TyConName, FunName, CaseFunName, TyCaseFunName, FunDef, Freq, Exp, Neutral, ExpType
newtypes:
Lexer: ParseError
DeBruijn: FreeVars
DesugaredSource: SPos, FName
Utils: SData
patterns:
Pretty: DText, DAt, DApp, DHApp, DSemi, DArr_, DCstr, DAnn, DLet, DComma, DPar, DParen, DBrace, DBracket, DOp, DOp0, DSep, DGlue, DArr, DForall,
DContext', DContext, DParContext, DLam, DLet'
Patterns: ParPat, PWildcard, PCon, ViewPat, PatType, PVarSimp, PConSimp, ViewPatSimp, PatTypeSimp, PParens, Otherwise
DesugaredSource: Ticked, CaseName, MatchName, SPos, SIName_, SIName, Tag, FTag, SBind, SPi, SLam, Wildcard, SLet, SLamV, SVar, SApp, SAppH, SAppV, SAppV2,
SBuiltin, SRHS, Section, SType, SConstraint, Parens, SAnn, SCW, TyType, HList, HCons, HNil, BList, BCons, BNil, UncurryS, AppsS, StLet, Primitive
Infer: EBind2, CheckType
Core: TType, NoRHS, Fun, CaseFun_, TyCaseFun_, App_, Con, TyCon, Lam, Pi, Let, SubstLet, CaseFun, TyCaseFun, Var, App, DFun, DFun_, UFun, DFunN,
DFunN_, ConN, TyConN, TTyCon0, :~>, TConstraint, Unit, TInt, TNat, TBool, TFloat, TString, TChar, TOrdering, TVec, Empty, TT, CUnit, CEmpty,
CstrT, CstrT', Coe, ParEval, T2, CW, CW_, CSplit,HLit, HInt, HFloat, HChar, HString, EBool, ENat, ReducedN, Reduced, FFix, NonNeut
Other material:
closure conversion tutorial: https://gist.github.com/jozefg/652f1d7407b7f0266ae9
inference: https://github.com/jozefg/higher-order-unification/blob/master/explanation.md
https://www.reddit.com/r/haskell/comments/6rs1bp/a_tutorial_on_implementing_higherorder/