Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
haskell
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
obsidiansystems
haskell
Commits
e464484e
Commit
e464484e
authored
5 years ago
by
Richard Eisenberg
Browse files
Options
Downloads
Patches
Plain Diff
Change polytypes from sg to s
parent
f71a732a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
grammar.ott
+20
-20
20 additions, 20 deletions
grammar.ott
haskell.mng
+5
-5
5 additions, 5 deletions
haskell.mng
rules.ott
+22
-22
22 additions, 22 deletions
rules.ott
with
47 additions
and
47 deletions
grammar.ott
+
20
−
20
View file @
e464484e
...
@@ -22,7 +22,7 @@ grammar
...
@@ -22,7 +22,7 @@ grammar
prog :: 'Prog_' ::= {{ com Programs }}
prog :: 'Prog_' ::= {{ com Programs }}
| empty :: :: Empty {{ com Empty }}
| empty :: :: Empty {{ com Empty }}
| f = e , prog :: :: Bind {{ com Inferred binding }}
| f = e , prog :: :: Bind {{ com Inferred binding }}
| f '::' s
g
'=' e , prog :: :: TypedBind {{ com Ascribed binding }}
| f '::' s '=' e , prog :: :: TypedBind {{ com Ascribed binding }}
CL :: 'ConLike_' ::= {{ com ConLikes }}
CL :: 'ConLike_' ::= {{ com ConLikes }}
| K :: :: RealDataCon {{ com Data constructor }}
| K :: :: RealDataCon {{ com Data constructor }}
...
@@ -40,8 +40,8 @@ e :: 'Expr_' ::= {{ com Expressions }}
...
@@ -40,8 +40,8 @@ e :: 'Expr_' ::= {{ com Expressions }}
| e1 e2 :: :: App {{ com Application }}
| e1 e2 :: :: App {{ com Application }}
| case e of { alts } :: :: Case {{ com Pattern-match }}
| case e of { alts } :: :: Case {{ com Pattern-match }}
| ( e ) :: :: Parens {{ com Grouping }}
| ( e ) :: :: Parens {{ com Grouping }}
| let x '::' s
g
= e1 in e2 :: :: Let {{ com Ascribed let }}
| let x '::' s = e1 in e2 :: :: Let {{ com Ascribed let }}
{{ tex \keyword{let}\ [[x]] [[::]] [[s
g
]] = [[e1]]\ \keyword{in}\ [[e2]] }}
{{ tex \keyword{let}\ [[x]] [[::]] [[s]] = [[e1]]\ \keyword{in}\ [[e2]] }}
alts {{ tex \overline{\ottnt{p} \to \ottnt{e} } }} :: 'Alts_' ::= {{ com Case alternatives }}
alts {{ tex \overline{\ottnt{p} \to \ottnt{e} } }} :: 'Alts_' ::= {{ com Case alternatives }}
| </ pi -> ei // i /> :: :: Patterns
| </ pi -> ei // i /> :: :: Patterns
...
@@ -49,7 +49,7 @@ alts {{ tex \overline{\ottnt{p} \to \ottnt{e} } }} :: 'Alts_' ::= {{ com Case al
...
@@ -49,7 +49,7 @@ alts {{ tex \overline{\ottnt{p} \to \ottnt{e} } }} :: 'Alts_' ::= {{ com Case al
p :: 'Pat_' ::= {{ com Patterns }}
p :: 'Pat_' ::= {{ com Patterns }}
| _ :: :: Underscore {{ com Wildcard }}
| _ :: :: Underscore {{ com Wildcard }}
| x :: :: Var {{ com Variable }}
| x :: :: Var {{ com Variable }}
| p '::' s
g
:: :: Sig {{ com Pattern signature }}
| p '::' s :: :: Sig {{ com Pattern signature }}
| CL ps :: :: Con {{ com Constructor }}
| CL ps :: :: Con {{ com Constructor }}
| CL atts ps :: :: ConTys {{ com Constructor with type arguments }}
| CL atts ps :: :: ConTys {{ com Constructor with type arguments }}
| ( p ) :: :: Parens {{ com Grouping }}
| ( p ) :: :: Parens {{ com Grouping }}
...
@@ -60,14 +60,14 @@ ps {{ tex \overline{\ottnt{p} } }} :: 'Pats_' ::= {{ com Lists of patterns }}
...
@@ -60,14 +60,14 @@ ps {{ tex \overline{\ottnt{p} } }} :: 'Pats_' ::= {{ com Lists of patterns }}
atts {{ tex \overline{\at \tau} }} :: 'AtTypes_' ::= {{ com Lists of visible type patterns }}
atts {{ tex \overline{\at \tau} }} :: 'AtTypes_' ::= {{ com Lists of visible type patterns }}
| @ t1 ... @ ti :: :: List
| @ t1 ... @ ti :: :: List
s
g
{{ tex \sigma }} :: 'SigTy_' ::= {{ com Type schemes }}
s {{ tex \sigma }} :: 'SigTy_' ::= {{ com Type schemes }}
| Q => s
g
:: :: ForallQTy {{ com Qualified type }}
| Q => s :: :: ForallQTy {{ com Qualified type }}
{{ tex [[Q]] [[=>]] [[s
g
]] }}
{{ tex [[Q]] [[=>]] [[s]] }}
| forall as . s
g
:: :: ForallTy {{ com Quantified type }}
| forall as . s :: :: ForallTy {{ com Quantified type }}
{{ tex [[forall]] [[as]].\,[[s
g
]] }}
{{ tex [[forall]] [[as]].\,[[s]] }}
| t :: :: MonoTy {{ com Monotype }}
| t :: :: MonoTy {{ com Monotype }}
| [ </ ai |-> ti // i /> ] s
g
:: M :: Subst
| [ </ ai |-> ti // i /> ] s :: M :: Subst
| theta ( s
g
) :: M :: SubstVar
| theta ( s ) :: M :: SubstVar
tvs {{ tex \overline{\ottnt{tv} } }}, as {{ tex \overline{\ottmv{a} } }}, bs {{ tex \overline{\ottmv{b} } }}, cs {{ tex \overline{\ottmv{c} } }} :: 'Vars_' ::= {{ com Lists of variables }}
tvs {{ tex \overline{\ottnt{tv} } }}, as {{ tex \overline{\ottmv{a} } }}, bs {{ tex \overline{\ottmv{b} } }}, cs {{ tex \overline{\ottmv{c} } }} :: 'Vars_' ::= {{ com Lists of variables }}
| </ ai // i /> :: :: List
| </ ai // i /> :: :: List
...
@@ -98,8 +98,8 @@ theta {{ tex \theta }} :: 'Subst_' ::= {{ com Type substitutions }}
...
@@ -98,8 +98,8 @@ theta {{ tex \theta }} :: 'Subst_' ::= {{ com Type substitutions }}
t {{ tex \tau }}, u {{ tex \upsilon }} :: 'Ty_' ::= {{ com Monotypes }}
t {{ tex \tau }}, u {{ tex \upsilon }} :: 'Ty_' ::= {{ com Monotypes }}
| a :: :: IVar {{ com Internal variable }}
| a :: :: IVar {{ com Internal variable }}
| c :: :: UVar {{ com External variable }}
| c :: :: UVar {{ com External variable }}
| s
g
-> t :: :: Fun {{ com Function }}
| s -> t :: :: Fun {{ com Function }}
| s
g
s -> t :: M :: Funs
| ss -> t :: M :: Funs
| T ts :: :: ConApp {{ com Constructor application }}
| T ts :: :: ConApp {{ com Constructor application }}
| theta t :: M :: Subst
| theta t :: M :: Subst
{{ tex [[theta]] [[t]] }}
{{ tex [[theta]] [[t]] }}
...
@@ -111,14 +111,14 @@ ts {{ tex \overline{\tau} }} :: 'Tys_' ::= {{ com Lists of monotypes }}
...
@@ -111,14 +111,14 @@ ts {{ tex \overline{\tau} }} :: 'Tys_' ::= {{ com Lists of monotypes }}
| </ ti // i /> :: :: List
| </ ti // i /> :: :: List
| as :: :: Vars
| as :: :: Vars
s
g
s {{ tex \overline{\sigma} }} :: 'Sigmas_' ::= {{ com Lists of polytypes }}
ss {{ tex \overline{\sigma} }} :: 'Sigmas_' ::= {{ com Lists of polytypes }}
| </ s
g
i // , // i /> :: :: List
| </ si // , // i /> :: :: List
G {{ tex \Gamma }}, Gt {{ tex \Gamma_t }} :: 'TyEnv_' ::= {{ com Type environments }}
G {{ tex \Gamma }}, Gt {{ tex \Gamma_t }} :: 'TyEnv_' ::= {{ com Type environments }}
| empty :: :: Empty {{ com Empty }}
| empty :: :: Empty {{ com Empty }}
| G1 , ... , Gn :: :: List {{ com Concatentation }}
| G1 , ... , Gn :: :: List {{ com Concatentation }}
| v : s
g
:: :: Var {{ com Variable binding }}
| v : s :: :: Var {{ com Variable binding }}
| CL : s
g
:: :: PatSyn {{ com ConLike binding }}
| CL : s :: :: PatSyn {{ com ConLike binding }}
| Q :: :: Constraint {{ com Given constraint }}
| Q :: :: Constraint {{ com Given constraint }}
| tv : type :: :: TyVar {{ com Type variable binding }}
| tv : type :: :: TyVar {{ com Type variable binding }}
| < tv : type > :: M :: TyVars
| < tv : type > :: M :: TyVars
...
@@ -128,7 +128,7 @@ G {{ tex \Gamma }}, Gt {{ tex \Gamma_t }} :: 'TyEnv_' ::= {{ com Type environmen
...
@@ -128,7 +128,7 @@ G {{ tex \Gamma }}, Gt {{ tex \Gamma_t }} :: 'TyEnv_' ::= {{ com Type environmen
| Giminus_one :: M :: GIHack
| Giminus_one :: M :: GIHack
obj :: 'SynObj' ::= {{ com Syntactic object }}
obj :: 'SynObj' ::= {{ com Syntactic object }}
| s
g
s :: :: TypeScheme
| ss :: :: TypeScheme
| Q :: :: Constraint
| Q :: :: Constraint
| G :: :: Context
| G :: :: Context
...
@@ -186,8 +186,8 @@ terminals :: 'terminals_' ::=
...
@@ -186,8 +186,8 @@ terminals :: 'terminals_' ::=
formula :: formula_ ::=
formula :: formula_ ::=
| judgement :: :: judgement
| judgement :: :: judgement
| formula1 '//' .. '//' formulan :: :: dots
| formula1 '//' .. '//' formulan :: :: dots
| ( v : s
g
) in G :: :: ctxtlookup
| ( v : s ) in G :: :: ctxtlookup
| ( P : s
g
) in G :: :: patsynlookup
| ( P : s ) in G :: :: patsynlookup
| theta1 = theta2 :: :: substdef
| theta1 = theta2 :: :: substdef
| G = G' :: :: ctxtdef
| G = G' :: :: ctxtdef
| tvrel :: :: tvrel
| tvrel :: :: tvrel
...
...
This diff is collapsed.
Click to expand it.
haskell.mng
+
5
−
5
View file @
e464484e
...
@@ -30,16 +30,16 @@
...
@@ -30,16 +30,16 @@
\section
{
Grammar
}
\section
{
Grammar
}
\nonterms
{
prog,CL,v,e,p,s
g
,Q,tv,theta,t,G
}
\nonterms
{
prog,CL,v,e,p,s,Q,tv,theta,t,G
}
\section
{
Typing rules
}
\section
{
Typing rules
}
\drules
[E]
{$
[[
G |
-
e : t
]]
$}{
Expressions
}{
VarCon,Eq,App,Abs,Case,Let
}
\drules
[E]
{$
[[
G |
-
e : t
]]
$}{
Expressions
}{
VarCon,Eq,App,Abs,Case,Let
}
Abstract judgments
$
[[
G ||
-
Q
]]
$
denotes entailment and
$
[[
G ||
-
s
g
1
<
=
s
g
2
]]
$
denotes
Abstract judgments
$
[[
G ||
-
Q
]]
$
denotes entailment and
$
[[
G ||
-
s
1
<
=
s
2
]]
$
denotes
subtyping (
$
[[
s
g
1
]]
$
is more general than
$
[[
s
g
2
]]
$
).
subtyping (
$
[[
s
1
]]
$
is more general than
$
[[
s
2
]]
$
).
\drules
[P]
{$
[[
G |
-
p p : s
g
=
> G'
]]
$}{
Patterns
}{
Var,Con,Syn,Sig
}
\drules
[P]
{$
[[
G |
-
p p : s
=
> G'
]]
$}{
Patterns
}{
Var,Con,Syn,Sig
}
\drules
[Ps]
{$
[[
G |
-
p
*
<
/
pi : s
g
i
//
i
/
>
=
> G'
]]
$}{
Pattern sequences
}{
PatSeq
}
\drules
[Ps]
{$
[[
G |
-
p
*
<
/
pi : si
//
i
/
>
=
> G'
]]
$}{
Pattern sequences
}{
PatSeq
}
\end{document}
\end{document}
This diff is collapsed.
Click to expand it.
rules.ott
+
22
−
22
View file @
e464484e
...
@@ -43,30 +43,30 @@ ftv(t) (= dom(G)
...
@@ -43,30 +43,30 @@ ftv(t) (= dom(G)
--------------------------------- :: Case
--------------------------------- :: Case
G |- case e of {</ pi -> ei // i />} : t
G |- case e of {</ pi -> ei // i />} : t
s
g
= forall cs. Q => u
s = forall cs. Q => u
ftv(s
g
) (= dom(G)
ftv(s) (= dom(G)
G, <c : type>, Q |- e : u
G, <c : type>, Q |- e : u
G, x : s
g
|- e2 : t
G, x : s |- e2 : t
----------------------------- :: Let
----------------------------- :: Let
G |- let x :: s
g
= e in e2 : t
G |- let x :: s = e in e2 : t
defn
defn
G ||- Q' :: :: ConImpl :: 'ConImpl_' {{ com Constraint implication }}
G ||- Q' :: :: ConImpl :: 'ConImpl_' {{ com Constraint implication }}
by
by
defn
defn
G ||- s
g
<= s
g
' :: :: Subtype :: 'SubType_' {{ com Subtyping relation}}
G ||- s <= s' :: :: Subtype :: 'SubType_' {{ com Subtyping relation}}
by
by
defn
defn
G |-p p : s
g
=> G' :: :: Pat :: 'P_' {{ com Pattern typing }}
G |-p p : s => G' :: :: Pat :: 'P_' {{ com Pattern typing }}
by
by
-------------------------------- :: Var
-------------------------------- :: Var
G |-p x : s
g
=> G, (x : s
g
)
G |-p x : s => G, (x : s)
(P : forall </ ai // i />. Qr => forall </ bj // j />. Qp => </ s
g
k // k /> -> u) in G
(P : forall </ ai // i />. Qr => forall </ bj // j />. Qp => </ sk // k /> -> u) in G
G' = G, (</ ai : type // i />), (</ ai ~ u'i // i />)
G' = G, (</ ai : type // i />), (</ ai ~ u'i // i />)
</ ai // i /> # dom(G)
</ ai // i /> # dom(G)
G' ||- (u ~ t) /\ Qr
G' ||- (u ~ t) /\ Qr
...
@@ -75,45 +75,45 @@ G' ||- (u ~ t) /\ Qr
...
@@ -75,45 +75,45 @@ G' ||- (u ~ t) /\ Qr
G'' = G',(</ bj : type // j />),(</ cl : type // l />),(</ cl ~ b'l // l />),Qp
G'' = G',(</ bj : type // j />),(</ cl : type // l />),(</ cl ~ b'l // l />),Qp
</ G'' ||- t'i ~ ai // i />
</ G'' ||- t'i ~ ai // i />
</ G'' ||- t''j ~ bj // j />
</ G'' ||- t''j ~ bj // j />
G'' |-p* </ pk : theta(s
g
k) // k /> => G'''
G'' |-p* </ pk : theta(sk) // k /> => G'''
-------------------------------- :: Syn
-------------------------------- :: Syn
G |-p P </ @ t'i // i /> </ @ t''j // j /> </ pk // k /> : t => G'''
G |-p P </ @ t'i // i /> </ @ t''j // j /> </ pk // k /> : t => G'''
(K : forall </ aj // j /> . Q => </ s
g
k // k /> -> T </ ui // i />) in G
(K : forall </ aj // j /> . Q => </ sk // k /> -> T </ ui // i />) in G
</ cl // l /> = ftv(</ t'j // j />) \ dom(G)
</ cl // l /> = ftv(</ t'j // j />) \ dom(G)
</ aj // j /> # dom(G)
</ aj // j /> # dom(G)
G' = G,(</ aj : type // j />),(</ cl : type // l />),(</ cl ~ t''l // l />),(</ ui ~ ti // i />),Q
G' = G,(</ aj : type // j />),(</ cl : type // l />),(</ cl ~ t''l // l />),(</ ui ~ ti // i />),Q
</ G' ||- t'j ~ aj // j />
</ G' ||- t'j ~ aj // j />
G' |-p* </ pk : s
g
k // k /> => G''
G' |-p* </ pk : sk // k /> => G''
-------------------------------- :: Con
-------------------------------- :: Con
G |-p K </ @ t'j // j /> </ pk // k /> : T </ ti // i /> => G''
G |-p K </ @ t'j // j /> </ pk // k /> : T </ ti // i /> => G''
cs = ftv(s
g
') \ dom(G)
cs = ftv(s') \ dom(G)
G' = G, <c : type>, < c ~ t >
G' = G, <c : type>, < c ~ t >
G' ||- s
g
<= s
g
'
G' ||- s <= s'
G' |-p p : s
g
' => G''
G' |-p p : s' => G''
-------------------------------- :: Sig
-------------------------------- :: Sig
G |-p (p :: s
g
') : s
g
=> G''
G |-p (p :: s') : s => G''
defn
defn
G |-p* </ pi : s
g
i // i /> => G' :: :: PatSeq :: 'Ps_' {{ com Pattern squence typing }}
G |-p* </ pi : si // i /> => G' :: :: PatSeq :: 'Ps_' {{ com Pattern squence typing }}
by
by
% help, how do I typeset that with G_{i-1}
% help, how do I typeset that with G_{i-1}
</ Giminus_one |-p pi : s
g
i => Gi // i IN 1 .. n />
</ Giminus_one |-p pi : si => Gi // i IN 1 .. n />
----------------------------- :: PatSeq
----------------------------- :: PatSeq
G0 |-p* </ pi : s
g
i // i IN 1 .. n /> => Gn
G0 |-p* </ pi : si // i IN 1 .. n /> => Gn
% defn
% defn
% G |-sb* e <= s
g
:: :: Check :: '' {{ com Checking against specified polytypes }}
% G |-sb* e <= s :: :: Check :: '' {{ com Checking against specified polytypes }}
% {{ tex [[G]] [[|-sb*]] [[e]] \Leftarrow [[s
g
]] }}
% {{ tex [[G]] [[|-sb*]] [[e]] \Leftarrow [[s]] }}
% by
% by
% G, c : type |-sb* e <= [a |-> c]s
g
% G, c : type |-sb* e <= [a |-> c]s
% --------------------------------- :: SB_DTyAbs
% --------------------------------- :: SB_DTyAbs
% G |-sb* \ @c . e <= forall a. s
g
% G |-sb* \ @c . e <= forall a. s
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment