-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHI 11 - Type Constructors #13
Open
hejohns
wants to merge
181
commits into
master
Choose a base branch
from
11-type-constructors
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 178 commits
Commits
Show all changes
181 commits
Select commit
Hold shift + click to select a range
d5c4db2
Initial draft
bkase 8b3f0dd
Adds note about type holes
bkase aaa112a
Delta supports htyp/varctx or kind/tyvarctx
bkase 696d9d9
Adds kind assignment, fixes a few bugs
bkase 41f5187
Updated for kind-assignment and sane delta
bkase f57dd56
Uses cdot for both empty sets
bkase b14fc0c
Attempts to add Ana uvar rule
bkase ecdcd5b
Judgements and changes for singleton kinds
bkase 0d0dcb9
Requested changes
bkase 1506086
Fixes issues in PHI, adds theorems for reasoning
bkase 2759c7e
Unrecognition tweak
bkase c43241e
Fixes for broken handling of tyvars
bkase b2ea0f1
Made suggested changes
bkase ed6b5e1
Latest changes
bkase ce7d4fe
Moves to bidirectional kind assignment
bkase 3f6986b
Tweaks to design docs
bkase f1f1ed1
Removes the extra recursive param in lines
bkase 99db512
Remove kind ascription on type equivalence
bkase 4410cd5
Synthesize self for tvars
bkase 8f53339
htau should be dtau in judgment box
hejohns 4201af8
KSVar bug?
hejohns bb3b828
let's backup before any possible hard drive failures!
hejohns 247cd79
ditto
hejohns bb3088e
good place to stop
hejohns 6d376f8
forgot some stuff
hejohns 3f093b3
small fixes before reading
hejohns 7bccc52
circularity mostly worked out?
hejohns d9c0c83
progress. I think
hejohns cd20c07
::>, :: better, but equivalence at superkinds still broken
hejohns ebc1cfd
is this necessary for consistentsubkinding+labeled singletons?
hejohns 644f71e
I think the solid rules are finally right.......
hejohns 43f2f9f
change ordering
hejohns f9491db
KindWellFormed
hejohns a3afbe4
auto number rules
hejohns ea84685
mucking around
hejohns 5a39d2f
probably should've named the branch 11-parameterized-types
hejohns 7e80c00
rename things
hejohns 838ac8d
does 21 make sense??
hejohns 9f6442b
a bunch of well formedness stuff
hejohns 9e1dfe0
sad. needs "redundant" premiss to be provable
hejohns cc97e96
slow progess
hejohns 9e68518
please don't let weaking be sim. inductive as well :(
hejohns 30576fe
remove redundant premisses
hejohns b6dbc6e
?! looks strange. But might actually work
hejohns 2fb1e60
are holes handled correctly now??
hejohns aa481af
title
hejohns 5942690
equality of types and KHole strangeness
hejohns c9d7b2a
type equality fixed?(take 2)
hejohns aefe5c8
actually need this rule after all
hejohns 311380e
yeah ok we do need refl,symm,trans for type equality
hejohns 2e1a28c
naming rules
hejohns 7bea7b2
about to regex so let's backup
hejohns 178ee30
eh
hejohns 6aa25fb
all rules named
hejohns 123f6af
weakening
hejohns efb1075
idk why I insisted on typing it all out last time
hejohns 8152963
fix exchange
hejohns ffbd8c4
I screwed up the layout of these lemmas
hejohns 9325d5c
huge waste of a day. but at least it worked out in the end?
hejohns 92f4950
fix context marking
hejohns cb0ab62
:(
hejohns a1c4806
dodged a KOMA-Script bullet
hejohns 86dd78e
:(
hejohns 66ec9c9
:-()
hejohns 047ff3c
I sure hope the trees swapped w/o error
hejohns 3332c80
I hate myself for not reversing the inferrule args earlier
hejohns d6f78f0
got vim macro'd to hell. We'll fix the spacing another time
hejohns 6603660
we've gone back/forth 100 times but COK does need subderivation
hejohns 2928d32
ended up just fixing weakening manually. had to fix an error
hejohns 642e010
this error
hejohns 21e7cd4
weaking looks good!
hejohns d981a97
finally figured out how to use typearea
hejohns 5277d18
I think we need induction on type size for K-subst
hejohns 8be7879
lemma -> theorem, OK-PK
hejohns 3a06278
must've changed DIV on accident
hejohns af7d58f
meant THIS one
hejohns 0fed84e
sending it out to cyrus-
hejohns f969eb0
might as well add the pptx
hejohns 1b1edeb
fell asleep; saving
hejohns 9651a66
singleton reduction/normalization rules?
hejohns f3d4356
named singleton reduction rules
hejohns 5e42ccf
mostly sketch PK-Unicity
hejohns 90e2dc6
singleton normalization unicity took too many steps
hejohns b399dc1
tiny bit of notes to myself
hejohns cbd6fe8
syntastic
hejohns a7e06fb
we actually do need this rule
hejohns 80ddf74
put code scratch here
hejohns 440c06c
HUnit instead
hejohns caac5f0
The most trivial cases
hejohns d209b78
what a waste of time fiddling w/ (.)/flip...
hejohns 6973fce
finish αRename
hejohns 7f50d1e
canonical form stuff
hejohns 3a19195
just to save what's in Algo so far
hejohns da687e0
hindent/various cosmetics
hejohns 1dfe911
too tired, just add everything
hejohns 5613974
wrap up last commit sorta-- canon isn't totally broken
hejohns d633581
move canon to Algo
hejohns b5c6d41
Need pk wfak csk now
hejohns a161847
need to do csk, then we can test some stuff
hejohns 57b6d99
hs-perl5 actually works.......
hejohns 8f9a0bc
regoranize tests to make running only some tests easier
hejohns 94b3867
what a fun way to implement fresh
hejohns ca43b99
focusing on getting tests working
hejohns 5590356
working on very basic test. Still not sure how to handle the mutually…
hejohns 2bd58d9
some self-induced pain because I didn't want to use de bruijn indeces
hejohns 2762e9a
≡_α for Typ s (although idk where we need it) as part of Rewrite class
hejohns 40aa431
Good canonKnd test
hejohns 41e63cc
debugging trace calls
hejohns c65c55c
current tests pass now; can keep moving forward
hejohns ef2dc25
check ≡_α in csk
hejohns 7b7d5ce
use kequiv instead of just ≡_α where appropriate
hejohns 8aaeb79
some basic tests pass
hejohns eb3753d
some documentation for myself (I think I'll Reason this soon)
hejohns 66edc62
need to run; doesn't build; need to handle base types like `list`
hejohns 455b31c
partial revert (working on η rules)
hejohns f092459
apparently hindent really doesn't like deriving via
hejohns e81f20a
forgot haskell has type families. doesn't build-- lots of changes
hejohns 540a87c
I didn't think this through-- need to revert last couple commits
hejohns a73675f
revert most of last couple commits (see last commit)
hejohns c85c950
clean the crumbs from last revert-- make it build
hejohns bfb5e56
need to run, but our current plan is to have two Aps for irriducible/…
hejohns 458f3c1
leaving this here, but we're gonna branch and move a lot
hejohns bcb806e
idk what's what anymore-- adding and then creating new files
hejohns e24cb49
reorganizing everything
hejohns 0557640
lots of changes. Reorganized everything to ex/internal language
hejohns 3a1900d
tooling paaaiiinn
hejohns ba49549
elab
hejohns c3b6103
a little wh/normal + hindent
hejohns 3da60be
path normalization reduces in the kind-- need to work out
hejohns fbfa586
tests pass again. But I'm not really sure what I've done
hejohns 3f164da
mpk
hejohns 6577ca0
used wrong ctx function
hejohns b966106
test exception call stack
hejohns f6e5222
hmmm not fun
hejohns ffacd61
simple test
hejohns b2a7b05
forgot recursive type_normal for HO singletons
hejohns fd92ad6
parser for writing tests: SEE LONG MESSAGE
hejohns dc74221
some tests from before
hejohns 9f74d92
well the test fails... but due to perl eval...
hejohns 9772124
I cannot l;we;nasdk
hejohns 1c2d0a8
adsf
hejohns 39e4cf4
epic fail. I mean seriously. ~5 hours wasted
hejohns 4711719
external expression langauge
hejohns ed846f8
Bidirectional typechecker basics
hejohns 021ba1a
syn tests
hejohns 8c2c03f
Didn't realize I didn't add BiDirectional.hs ... rip git history
hejohns ec2df08
writing up algorithmic rules
hejohns 23a220e
type normal
hejohns 35da088
did that perl filter actually work
hejohns 500f790
AlgTypeNormal
hejohns b19d8fb
AlgWHNormal
hejohns fd7bb16
make sure binop types normalize correctly
hejohns 291c09d
AlgNatKind
hejohns 0d20a8e
typo in path normal (caught during latexing). TODO: test should ve ex…
hejohns 810b293
AlgPathNormal
hejohns 76219f8
ElimCtx not EvalCtx
hejohns b085914
number alg rules for now
hejohns d459cec
start gradualizing type equality
hejohns de980ae
some perl pie action: |- to ⊢
hejohns eb3b80f
typo
hejohns a03263d
term_normal at KHole?
hejohns fb54ccc
initial gradualization and csk and kequiv
hejohns 37eef7b
I think caught up gradual
hejohns 39b68e2
as discussed in OH minus TODO s
hejohns 4756f0d
part way through tidying up for PR
hejohns 8c8bbc4
make isPath a judgment
hejohns a1432d2
partial revert: we did need this whreduc rule
hejohns cdd9fff
minor fixes
hejohns 757b419
clarify normalize at kind and fill in TODO
hejohns 690c4a6
clean up notes
hejohns d549b0c
rename md tex source to reduce confusion
hejohns 0832702
rename j.....dunfield.sty by getting upstream version
hejohns 3242dd8
add information to jdunfield.sty header
hejohns 5531f4d
comment out \newcommand{\mathcolor}{..} for now and build
hejohns 12eabe1
fix \today substitution
hejohns 5a40fcf
update hejohns-colors
hejohns c319f0a
fixup latex, incorporating recent hejohns-stub changes and comment ou…
hejohns ec4973b
need to write md
hejohns 892a2ec
bump to newer ghc by removing unused Language.Perl dependency
hejohns 4e1ef53
untrack tex to generate md-- just don't accidentally rm it locally...
hejohns 962e2ac
...and we're going back to older ghc since hls doesn't work for some …
hejohns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\documentclass[12pt]{article} | ||
% packages don't actually matter to pandoc afaik | ||
|
||
\begin{document} | ||
\section*{11-type-constructors} | ||
\today % pandoc doesn't handle \today. ./latex2md uses `date` | ||
\subsection*{Introduction} | ||
This proposal extends the type language with the machinery needed for parameterized type definitions. | ||
\subsubsection*{Example: Parametized Pairs} | ||
\begin{verbatim} | ||
type Pair a = (a, a) in | ||
\end{verbatim} | ||
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 11-type-constructors | ||
|
||
2022-08-24 | ||
|
||
## Introduction | ||
|
||
This proposal extends the type language with the machinery needed for | ||
parameterized type definitions. | ||
|
||
### Example: Parametized Pairs | ||
|
||
type Pair a = (a, a) in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 11-type-constructors | ||
|
||
2022-08-24 | ||
|
||
## Introduction | ||
|
||
This proposal extends the type language with the machinery needed for | ||
parameterized type definitions. | ||
|
||
### Example: Parametized Pairs | ||
|
||
type Pair a = (a, a) in |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.PHONY: test | ||
test: | ||
cabal test --test-show-details=streaming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
cabal-version: 3.6 | ||
name: algo | ||
version: 0.1.0.0 | ||
|
||
-- A short (one-line) description of the package. | ||
-- synopsis: | ||
|
||
-- A longer description of the package. | ||
-- description: | ||
|
||
-- A URL where users can report bugs. | ||
-- bug-reports: | ||
|
||
-- The license under which the package is released. | ||
-- license: | ||
author: hejohns | ||
maintainer: [email protected] | ||
|
||
-- A copyright notice. | ||
-- copyright: | ||
-- category: | ||
extra-source-files: CHANGELOG.md | ||
|
||
library | ||
exposed-modules: Algo | ||
hs-source-dirs: src | ||
other-modules: Common | ||
External | ||
Internal | ||
ECtx | ||
ICtx | ||
Normalize | ||
BiDirectional | ||
build-depends: base ^>=4.16.0.0 | ||
,hs-perl5 | ||
,shqq | ||
default-language: GHC2021 | ||
ghc-options: -Wall -Wno-unused-matches | ||
|
||
test-suite test-algo | ||
type: exitcode-stdio-1.0 | ||
main-is: Tests.hs | ||
hs-source-dirs: test | ||
other-modules: Lexer | ||
Parser | ||
build-depends: base ^>=4.16.0.0 | ||
,HUnit | ||
,algo | ||
,array | ||
default-language: GHC2021 | ||
-- man perlembed: `perl -MExtUtils::Embed -e ccopts -e ldopts` | ||
-- and then pruned for stuff ghc doesn't understand | ||
-- NOTE: yes, I know cabal complains about using ghc-options this way | ||
-- but this is easier to manage for me, the human | ||
ghc-options: -Wall -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread -lc -lcrypt -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.34/CORE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
packages: ./*.cabal | ||
jobs: $ncpus | ||
optimization: 0 | ||
profiling: True | ||
profiling-detail: all-functions | ||
|
||
source-repository-package | ||
type: git | ||
location: https://github.com/phlummox/hs-perl5.git | ||
tag: 22d1aa69c4f101873c81ac9a2ff4a208a96cd1d4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Algo | ||
( module Algo -- does nothing right now | ||
, module Common | ||
, module Normalize -- to call algorithms | ||
, module ECtx -- initial contexts | ||
, module External -- so we can write types | ||
, module BiDirectional | ||
) where | ||
|
||
import BiDirectional hiding ((⊳→)) | ||
import Common | ||
import ECtx | ||
import External | ||
import Normalize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{-# LANGUAGE PostfixOperators #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
{-# LANGUAGE DuplicateRecordFields #-} | ||
{-# LANGUAGE OverloadedRecordDot #-} | ||
|
||
module BiDirectional where | ||
|
||
import Common | ||
import Data.Maybe | ||
import qualified ECtx | ||
import qualified External as E | ||
import qualified ICtx | ||
import qualified Internal as I | ||
import Normalize hiding ((⊳→)) | ||
|
||
syn :: ECtx.Ctx -> E.Exp -> Maybe I.Term | ||
syn eΓ eδ = do | ||
iΓ <- fixCtx eΓ | ||
syn' iΓ eδ | ||
|
||
syn' :: ICtx.Ctx -> E.Exp -> Maybe I.Term | ||
syn' iΓ (E.EVar t) = ICtx.lookupE iΓ t | ||
syn' iΓ (E.Eλ x eτ eδ) = do | ||
SER {term = iδ1, ..} <- syn_elab' iΓ eτ | ||
iδ2 <- syn' (iΓ ICtx.⌢⌢⌢ (x, iδ1)) eδ | ||
return $ iδ1 I.:⊕ iδ2 | ||
syn' iΓ (E.EAp eδ1 eδ2) = do | ||
iδ1 <- syn' iΓ eδ1 | ||
let MATR {..} = iΓ ⊢ (iδ1 ⊳→) | ||
ana iΓ eδ2 iδIn &>> return iδOut | ||
syn' iΓ (E.ETypLet t eτ eδ) = do | ||
SER {typ = iτ, term = iδ, ..} <- syn_elab' iΓ eτ | ||
let innerΓ = (iΓ ICtx.⌢ (t, iτ)) | ||
iδ' <- syn' innerΓ eδ | ||
return $ insensitiveβnormal (subst iδ t iδ') | ||
syn' iΓ (E.EExpLet x eτ eδDef eδBody) = do | ||
SER {term = iδ, ..} <- syn_elab' iΓ eτ | ||
ana iΓ eδDef iδ &>> syn' (iΓ ICtx.⌢⌢⌢ (x, iδ)) eδBody | ||
|
||
ana :: ICtx.Ctx -> E.Exp -> I.Term -> Bool | ||
ana iΓ eδ iδ' = fromMaybe False (syn' iΓ eδ >>= \iδ -> Just (iΓ ⊢ (iδ ~ iδ' $ I.Type))) | ||
|
||
data MATResult = | ||
MATR | ||
{ iδIn :: I.Term | ||
, iδOut :: I.Term | ||
} | ||
deriving (Show) | ||
|
||
-- TODO: type suggests this is to be generalized to ``consistent sub type (constructor)'' | ||
-- but right now is only ``consistent sub type (at kind Type)'' | ||
cst' :: ICtx.Ctx -> I.Term -> I.Term -> I.Typ -> Bool | ||
cst' _ (I.ETHole _) _ _ = True | ||
cst' _ _ (I.ETHole _) _ = True | ||
cst' _ (I.NETHole _ _) _ _ = True | ||
cst' _ _ (I.NETHole _ _) _ = True | ||
cst' iΓ (iδ1 I.:⊕ iδ2) (iδ1' I.:⊕ iδ2') iτ = | ||
cst' iΓ iδ1 iδ1' iτ && cst' iΓ iδ2 iδ2' iτ | ||
cst' iΓ iδ1 iδ2 iτ = tequiv' iΓ iδ1 iδ2 iτ | ||
|
||
(~) :: I.Term -> I.Term -> I.Typ -> ICtx.Ctx -> Bool | ||
(~) = ((.) . (.) $ flip) . ((.) flip) . flip $ cst' | ||
|
||
mat' :: ICtx.Ctx -> I.Term -> MATResult | ||
mat' _ (I.ETHole u) = MATR (I.ETHole u) (I.ETHole u) | ||
mat' _ (iδ1 I.:⊕ iδ2) = MATR iδ1 iδ2 | ||
mat' aΓ δ = | ||
case wh_reduc aΓ δ of | ||
Left _ -> error $ "Can't (⊳→) on this bogus value: " ++ (show aΓ) ++ " ⊢ " ++ (show δ) | ||
Right δ' -> mat' aΓ δ' | ||
|
||
(⊳→) = flip mat' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
-- NOTE: we alwys assume programs are α-renamed so no shadowing occurs | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
|
||
module Common where | ||
|
||
import Control.Monad (MonadPlus, mzero) | ||
import Language.Perl | ||
import System.IO.Unsafe | ||
import System.ShQQ | ||
|
||
type TID = String | ||
|
||
type HID = Int | ||
|
||
class Eq a => | ||
Rewrite a | ||
{- | ||
- (==) must be ≡_α | ||
-} | ||
where | ||
type RW a | ||
(≡) :: a -> a -> Bool | ||
(≡) = (==) | ||
{- | ||
- okay, not exactly an alpha-conversion, | ||
- but replaces all instances of a variable with another | ||
-} | ||
αRename :: TID -> TID -> a -> a | ||
subst :: RW a -> TID -> a -> a | ||
|
||
infix 4 ≡ | ||
|
||
-- utilities: | ||
(&>>) :: MonadPlus m => Bool -> m a -> m a | ||
(&>>) True = id | ||
(&>>) False = \_ -> mzero | ||
|
||
infix 2 &>> | ||
|
||
-- when Γ is the first argument | ||
(⊢) :: a -> (a -> b) -> b | ||
aΓ ⊢ f = f aΓ | ||
|
||
-- when Γ is the last argument | ||
(|>) :: a -> (a -> b) -> b | ||
aΓ |> f = f aΓ | ||
|
||
infixl 2 |> | ||
|
||
fresh :: TID -> TID | ||
fresh t = | ||
let p = | ||
"my $tid = '" ++ | ||
t ++ | ||
"';" ++ | ||
"$tid =~ /(\\D+)(\\d+)?/;" ++ | ||
"if(defined $2){" ++ | ||
"$_ = $1 . ($2 + 1)" ++ "} else{" ++ "$_ = $1 . '1'" ++ "}" | ||
in let pp = p ++ "; print" | ||
in unsafePerformIO $ [sh| perl -e $pp |] | ||
|
||
{- | ||
withPerl $ | ||
eval $ | ||
-} | ||
fresh2 :: TID -> TID -> TID | ||
fresh2 t t' = | ||
let p = | ||
"my $tid1 = '" ++ | ||
t ++ | ||
"';" ++ | ||
"my $tid2 = '" ++ | ||
t' ++ | ||
"';" ++ | ||
"$tid1 =~ /(\\D+)(\\d+)?/;" ++ | ||
"my ($tid1_1, $tid1_2) = ($1, $2);" ++ | ||
"$tid2 =~ /(\\D+)(\\d+)?/;" ++ | ||
"my ($tid2_1, $tid2_2) = ($1, $2);" ++ "$_ = $tid1_1 . $tid2_1 . '1'" | ||
in let pp = p ++ "; print" | ||
in unsafePerformIO $ [sh| perl -e $pp |] | ||
|
||
{- | ||
withPerl $ | ||
eval $ | ||
-} | ||
freshfresh :: TID | ||
freshfresh = | ||
let p = "$_ = 'mpk' . time()" | ||
in let pp = p ++ "; print" | ||
in unsafePerformIO $ [sh| perl -e $pp |] | ||
{- | ||
withPerl $ eval $ | ||
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module ECtx where | ||
|
||
import Common | ||
import External | ||
|
||
type EAssump = (TID, Typ) | ||
|
||
type TAssump = (TID, Knd) | ||
|
||
data Ctx | ||
= Nil | ||
| Ctx :⌢ TAssump | ||
| Ctx :⌢⌢⌢ EAssump | ||
deriving (Show) | ||
|
||
lookupT :: Ctx -> TID -> Maybe Knd | ||
lookupT Nil _ = Nothing | ||
lookupT (aΓ :⌢ (t', κ)) t | ||
| t' == t = Just κ | ||
| otherwise = lookupT aΓ t | ||
lookupT (aΓ :⌢⌢⌢ _) t = lookupT aΓ t | ||
|
||
lookupE :: Ctx -> TID -> Maybe Typ | ||
lookupE Nil _ = Nothing | ||
lookupE (iΓ :⌢ _) t = lookupE iΓ t | ||
lookupE (iΓ :⌢⌢⌢ (t', τ)) t | ||
| t' == t = Just τ | ||
| otherwise = lookupE iΓ t | ||
|
||
(⌢) :: Ctx -> TAssump -> Ctx | ||
(⌢) aΓ tassump@(t, _κ) = | ||
case lookupT aΓ t of | ||
Just _ -> error "Do not shadow" | ||
Nothing -> aΓ :⌢ tassump | ||
|
||
(⌢⌢⌢) :: Ctx -> EAssump -> Ctx | ||
(⌢⌢⌢) aΓ eassump@(x, _τ) = | ||
case lookupE aΓ x of | ||
Just _ -> error "Do not shadow" | ||
Nothing -> aΓ :⌢⌢⌢ eassump |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should be deleted I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to generate the markdown file
I can delete it since it seems like it's confusing