-
authorMart Lubbers <mart@martlubbers.net>
Wed, 19 Feb 2020 08:14:04 +0000 (09:14 +0100)
committerMart Lubbers <mart@martlubbers.net>
Wed, 19 Feb 2020 08:14:04 +0000 (09:14 +0100)
253 files changed:
deep.icl [new file with mode: 0644]
dep/a.out [deleted file]
eadt.icl [new file with mode: 0644]
exeditor/test.icl [new file with mode: 0644]
foreign/test.c [deleted file]
gopt/gopt.icl [deleted file]
old/228-rawvarcons-in-default-layout-for-certain-adt/test.icl [moved from 228-rawvarcons-in-default-layout-for-certain-adt/test.icl with 100% similarity]
old/237-deriving-generic-editors-for-newtypes-crashes/test.icl [moved from 237-deriving-generic-editors-for-newtypes-crashes/test.icl with 100% similarity]
old/238-geditor-for-maybe-is-broken/test.icl [moved from 238-geditor-for-maybe-is-broken/test.icl with 100% similarity]
old/239-derived-editor-for-map-broken/test.icl [moved from 239-derived-editor-for-map-broken/test.icl with 100% similarity]
old/7gui/test.icl [moved from 7gui/test.icl with 100% similarity]
old/TimeGraph.zip [moved from TimeGraph.zip with 100% similarity]
old/abc/test.icl [moved from abc/test.icl with 100% similarity]
old/abstract-newtypes/nt.dcl [moved from abstract-newtypes/nt.dcl with 100% similarity]
old/abstract-newtypes/nt.icl [moved from abstract-newtypes/nt.icl with 100% similarity]
old/afp/a1/a.icl [moved from afp/a1/a.icl with 100% similarity]
old/afp/a10/a10 [new file with mode: 0755]
old/afp/a10/a10.icl [moved from afp/a10/a10.icl with 100% similarity]
old/afp/a10/setGADT.icl [moved from afp/a10/setGADT.icl with 100% similarity]
old/afp/a11/a11.icl [moved from afp/a11/a11.icl with 100% similarity]
old/afp/a12/cashModel.dcl [moved from afp/a12/cashModel.dcl with 100% similarity]
old/afp/a12/cashModel.icl [moved from afp/a12/cashModel.icl with 100% similarity]
old/afp/a12/gastyStart.dcl [moved from afp/a12/gastyStart.dcl with 100% similarity]
old/afp/a12/gastyStart.icl [moved from afp/a12/gastyStart.icl with 100% similarity]
old/afp/a12/testCash.icl [moved from afp/a12/testCash.icl with 100% similarity]
old/afp/a2/a2.icl [moved from afp/a2/a2.icl with 100% similarity]
old/afp/a2/a2a.icl [moved from afp/a2/a2a.icl with 100% similarity]
old/afp/a3/genericMap.icl [moved from afp/a3/genericMap.icl with 100% similarity]
old/afp/a3/serialize3Start.icl [moved from afp/a3/serialize3Start.icl with 100% similarity]
old/afp/a3/serializenative.icl [moved from afp/a3/serializenative.icl with 100% similarity]
old/afp/a4/skeleton4.icl [moved from afp/a4/skeleton4.icl with 100% similarity]
old/afp/a5/a5 [moved from afp/a5/a5 with 100% similarity]
old/afp/a5/a5.icl [moved from afp/a5/a5.icl with 100% similarity]
old/afp/a6/a7.icl [moved from afp/a6/a7.icl with 100% similarity]
old/afp/a7/a7.icl [moved from afp/a7/a7.icl with 100% similarity]
old/afp/a8/a8 [new file with mode: 0755]
old/afp/a8/a8.icl [moved from afp/a8/a8.icl with 100% similarity]
old/afp/a8/a8_old.icl [moved from afp/a8/a8_old.icl with 100% similarity]
old/afp/a9/a8 [new file with mode: 0755]
old/afp/a9/a9 [new file with mode: 0755]
old/afp/a9/a9.icl [moved from afp/a9/a9.icl with 100% similarity]
old/alacarte/calc.icl [moved from alacarte/calc.icl with 100% similarity]
old/append-ed/Makefile [moved from append-ed/Makefile with 100% similarity]
old/append-ed/test.icl [moved from append-ed/test.icl with 100% similarity]
old/array_fun/test.icl [moved from array_fun/test.icl with 100% similarity]
old/array_itasks/Mul.dcl [moved from array_itasks/Mul.dcl with 100% similarity]
old/array_itasks/Sub.dcl [moved from array_itasks/Sub.dcl with 100% similarity]
old/array_itasks/T.dcl [moved from array_itasks/T.dcl with 100% similarity]
old/array_itasks/main.dcl [moved from array_itasks/main.dcl with 100% similarity]
old/array_itasks/test.icl [moved from array_itasks/test.icl with 100% similarity]
old/arrayfunctor/test.icl [moved from arrayfunctor/test.icl with 100% similarity]
old/base64/test.icl [moved from base64/test.icl with 100% similarity]
old/benchmark/test.icl [moved from benchmark/test.icl with 100% similarity]
old/benchmark/test.sh [moved from benchmark/test.sh with 100% similarity]
old/booking/Booking [moved from booking/Booking with 100% similarity]
old/booking/Booking.icl [moved from booking/Booking.icl with 100% similarity]
old/booking/test.icl [moved from booking/test.icl with 100% similarity]
old/bug/t.icl [moved from bug/t.icl with 100% similarity]
old/bugs/test.icl [moved from bugs/test.icl with 100% similarity]
old/choose/Makefile [moved from choose/Makefile with 100% similarity]
old/choose/test.icl [moved from choose/test.icl with 100% similarity]
old/cleanup/test.icl [moved from cleanup/test.icl with 100% similarity]
old/cli/test.icl [moved from cli/test.icl with 100% similarity]
old/codegenbug/Data/GenC.dcl [moved from codegenbug/Data/GenC.dcl with 100% similarity]
old/codegenbug/Data/GenC.icl [moved from codegenbug/Data/GenC.icl with 100% similarity]
old/codegenbug/test.icl [moved from codegenbug/test.icl with 100% similarity]
old/conj-semantics/Makefile [moved from conj-semantics/Makefile with 100% similarity]
old/conj-semantics/test.icl [moved from conj-semantics/test.icl with 100% similarity]
old/constructordynamic/test.icl [moved from constructordynamic/test.icl with 100% similarity]
old/contparse/test.icl [moved from contparse/test.icl with 100% similarity]
old/csg/p.icl [moved from csg/p.icl with 100% similarity]
old/deep-var/eval.dcl [moved from deep-var/eval.dcl with 100% similarity]
old/deep-var/eval.icl [moved from deep-var/eval.icl with 100% similarity]
old/deep-var/pprint [moved from deep-var/pprint with 100% similarity]
old/deep-var/pprint.dcl [moved from deep-var/pprint.dcl with 100% similarity]
old/deep-var/pprint.icl [moved from deep-var/pprint.icl with 100% similarity]
old/deep-var/test.dcl [moved from deep-var/test.dcl with 100% similarity]
old/deep-var/test.icl [moved from deep-var/test.icl with 100% similarity]
old/dep/test.icl [moved from dep/test.icl with 100% similarity]
old/documents/Makefile [moved from documents/Makefile with 100% similarity]
old/documents/test.icl [moved from documents/test.icl with 100% similarity]
old/doublylinked/test.icl [moved from doublylinked/test.icl with 100% similarity]
old/dropExtension/test.icl [moved from dropExtension/test.icl with 100% similarity]
old/dsl/dsl.icl [moved from dsl/dsl.icl with 100% similarity]
old/dupworld/test.icl [moved from dupworld/test.icl with 100% similarity]
old/dyn/Makefile [moved from dyn/Makefile with 100% similarity]
old/dyn/T.dcl [moved from dyn/T.dcl with 100% similarity]
old/dyn/T.icl [moved from dyn/T.icl with 100% similarity]
old/dyn/test.icl [moved from dyn/test.icl with 100% similarity]
old/dynamicclass/test.icl [moved from dynamicclass/test.icl with 100% similarity]
old/dyneditors/DynEditorExample.icl [moved from dyneditors/DynEditorExample.icl with 100% similarity]
old/dyneditors/DynamicEditor.dcl [moved from dyneditors/DynamicEditor.dcl with 100% similarity]
old/dyneditors/DynamicEditor.icl [moved from dyneditors/DynamicEditor.icl with 100% similarity]
old/eadt/Mul.dcl [moved from eadt/Mul.dcl with 100% similarity]
old/eadt/Mul.icl [moved from eadt/Mul.icl with 100% similarity]
old/eadt/Sub.dcl [moved from eadt/Sub.dcl with 100% similarity]
old/eadt/Sub.icl [moved from eadt/Sub.icl with 100% similarity]
old/eadt/T.dcl [moved from eadt/T.dcl with 100% similarity]
old/eadt/T.icl [moved from eadt/T.icl with 100% similarity]
old/eadt/export/B.dcl [moved from eadt/export/B.dcl with 100% similarity]
old/eadt/export/B.icl [moved from eadt/export/B.icl with 100% similarity]
old/eadt/export/C.dcl [moved from eadt/export/C.dcl with 100% similarity]
old/eadt/export/C.icl [moved from eadt/export/C.icl with 100% similarity]
old/eadt/export/main.dcl [moved from eadt/export/main.dcl with 100% similarity]
old/eadt/export/main.icl [moved from eadt/export/main.icl with 100% similarity]
old/eadt/main.dcl [moved from eadt/main.dcl with 100% similarity]
old/eadt/main.icl [moved from eadt/main.icl with 100% similarity]
old/eadt/test.icl [moved from eadt/test.icl with 100% similarity]
old/expr/class [moved from expr/class with 100% similarity]
old/expr/class.dcl [moved from expr/class.dcl with 100% similarity]
old/expr/class.icl [moved from expr/class.icl with 100% similarity]
old/expr/deep [moved from expr/deep with 100% similarity]
old/expr/deep.icl [moved from expr/deep.icl with 100% similarity]
old/expr/exist/exist [moved from expr/exist/exist with 100% similarity]
old/expr/exist/exist.dcl [moved from expr/exist/exist.dcl with 100% similarity]
old/expr/exist/exist.icl [moved from expr/exist/exist.icl with 100% similarity]
old/expr/exist/existFor.dcl [moved from expr/exist/existFor.dcl with 100% similarity]
old/expr/exist/existMult.dcl [moved from expr/exist/existMult.dcl with 100% similarity]
old/expr/exist/existMult.icl [moved from expr/exist/existMult.icl with 100% similarity]
old/expr/exist/while.dcl [moved from expr/exist/while.dcl with 100% similarity]
old/expr/exist/while.icl [moved from expr/exist/while.icl with 100% similarity]
old/expr/exist/whileMult.dcl [moved from expr/exist/whileMult.dcl with 100% similarity]
old/expr/exist/whileMult.icl [moved from expr/exist/whileMult.icl with 100% similarity]
old/expr/exist/whileRep.dcl [moved from expr/exist/whileRep.dcl with 100% similarity]
old/expr/exist/whileRep.icl [moved from expr/exist/whileRep.icl with 100% similarity]
old/expr/expr.md [moved from expr/expr.md with 100% similarity]
old/expr/gadt [moved from expr/gadt with 100% similarity]
old/expr/gadt.icl [moved from expr/gadt.icl with 100% similarity]
old/expr/shallow [moved from expr/shallow with 100% similarity]
old/expr/shallow.icl [moved from expr/shallow.icl with 100% similarity]
old/exprparse/test.icl [moved from exprparse/test.icl with 100% similarity]
old/expruniq/shallow.icl [moved from expruniq/shallow.icl with 100% similarity]
old/expruniq/uexpr.icl [moved from expruniq/uexpr.icl with 100% similarity]
old/ext/test.dcl [moved from ext/test.dcl with 100% similarity]
old/ext/test.icl [moved from ext/test.icl with 100% similarity]
old/filepicker/prj [moved from filepicker/prj with 100% similarity]
old/filepicker/test.icl [moved from filepicker/test.icl with 100% similarity]
old/filepickerbas/test.icl [moved from filepickerbas/test.icl with 100% similarity]
old/fixwidthstr/test.icl [moved from fixwidthstr/test.icl with 100% similarity]
old/foreign/Makefile [moved from foreign/Makefile with 100% similarity]
old/foreign/fac.dcl [moved from foreign/fac.dcl with 100% similarity]
old/foreign/fac.icl [moved from foreign/fac.icl with 100% similarity]
old/foreign/test.dcl [moved from foreign/test.dcl with 100% similarity]
old/foreign/test.icl [moved from foreign/test.icl with 100% similarity]
old/fullscreen/Makefile [moved from fullscreen/Makefile with 100% similarity]
old/fullscreen/test.icl [moved from fullscreen/test.icl with 100% similarity]
old/fun/test.icl [moved from fun/test.icl with 100% similarity]
old/funcdeps/test.icl [moved from funcdeps/test.icl with 100% similarity]
old/gast-der/test Time Profile.pcl [moved from gast-der/test Time Profile.pcl with 100% similarity]
old/gast-der/test.icl [moved from gast-der/test.icl with 100% similarity]
old/gast-der/testnf [moved from gast-der/testnf with 100% similarity]
old/gast-der/testnf Time Profile.pcl [moved from gast-der/testnf Time Profile.pcl with 100% similarity]
old/gast-itasks/test.icl [moved from gast-itasks/test.icl with 100% similarity]
old/geditor-arity/Makefile [moved from geditor-arity/Makefile with 100% similarity]
old/geditor-arity/test.icl [moved from geditor-arity/test.icl with 100% similarity]
old/gen/test.icl [moved from gen/test.icl with 100% similarity]
old/gencons/Makefile [moved from gencons/Makefile with 100% similarity]
old/gencons/test.icl [moved from gencons/test.icl with 100% similarity]
old/generic_classes/C.dcl [moved from generic_classes/C.dcl with 100% similarity]
old/generic_classes/C.icl [moved from generic_classes/C.icl with 100% similarity]
old/generic_classes/Makefile [moved from generic_classes/Makefile with 100% similarity]
old/generic_classes/test.icl [moved from generic_classes/test.icl with 100% similarity]
old/generic_constraints/test.icl [moved from generic_constraints/test.icl with 100% similarity]
old/gentests/test.icl [moved from gentests/test.icl with 100% similarity]
old/haye_test/test.icl [moved from haye_test/test.icl with 100% similarity]
old/hex/hex.icl [moved from hex/hex.icl with 100% similarity]
old/higher-order/test.icl [moved from higher-order/test.icl with 100% similarity]
old/iTasks-notifications/Makefile [moved from iTasks-notifications/Makefile with 100% similarity]
old/iTasks-notifications/test.icl [moved from iTasks-notifications/test.icl with 100% similarity]
old/if/Makefile [moved from if/Makefile with 100% similarity]
old/if/test.icl [moved from if/test.icl with 100% similarity]
old/inf-default/test.icl [moved from inf-default/test.icl with 100% similarity]
old/infdomain/test.icl [moved from infdomain/test.icl with 100% similarity]
old/iot/test.icl [moved from iot/test.icl with 100% similarity]
old/json-bigbytes/test.icl [moved from json-bigbytes/test.icl with 100% similarity]
old/json-eq-string/test.icl [moved from json-eq-string/test.icl with 100% similarity]
old/jsonmap/test.icl [moved from jsonmap/test.icl with 100% similarity]
old/lat/test.icl [moved from lat/test.icl with 100% similarity]
old/letrec/test.icl [moved from letrec/test.icl with 100% similarity]
old/library/test.icl [moved from library/test.icl with 100% similarity]
old/linker/test.icl [moved from linker/test.icl with 100% similarity]
old/list_types/test.icl [moved from list_types/test.icl with 100% similarity]
old/macros/test.icl [moved from macros/test.icl with 100% similarity]
old/macros/test.log [moved from macros/test.log with 100% similarity]
old/malfunctioning_dropdowns/Makefile [moved from malfunctioning_dropdowns/Makefile with 100% similarity]
old/malfunctioning_dropdowns/test.icl [moved from malfunctioning_dropdowns/test.icl with 100% similarity]
old/maybe-migration/Makefile [moved from maybe-migration/Makefile with 100% similarity]
old/maybe-migration/test.icl [moved from maybe-migration/test.icl with 100% similarity]
old/metaeditor/.gitignore [moved from metaeditor/.gitignore with 100% similarity]
old/metaeditor/EditorExt.dcl [moved from metaeditor/EditorExt.dcl with 100% similarity]
old/metaeditor/EditorExt.icl [moved from metaeditor/EditorExt.icl with 100% similarity]
old/metaeditor/MetaType.dcl [moved from metaeditor/MetaType.dcl with 100% similarity]
old/metaeditor/MetaType.icl [moved from metaeditor/MetaType.icl with 100% similarity]
old/metaeditor/ed.icl [moved from metaeditor/ed.icl with 100% similarity]
old/new-external/Makefile [moved from new-external/Makefile with 100% similarity]
old/new-external/test.icl [moved from new-external/test.icl with 100% similarity]
old/new-layouts/Makefile [moved from new-layouts/Makefile with 100% similarity]
old/new-layouts/test.icl [moved from new-layouts/test.icl with 100% similarity]
old/newtype-editor/Makefile [moved from newtype-editor/Makefile with 100% similarity]
old/newtype-editor/test.icl [moved from newtype-editor/test.icl with 100% similarity]
old/onclick/test.icl [moved from onclick/test.icl with 100% similarity]
old/overloading_tc/test.icl [moved from overloading_tc/test.icl with 100% similarity]
old/paard.icl [moved from paard.icl with 100% similarity]
old/parallel-action/Makefile [moved from parallel-action/Makefile with 100% similarity]
old/parallel-action/test.icl [moved from parallel-action/test.icl with 100% similarity]
old/parseclass/expr.icl [moved from parseclass/expr.icl with 100% similarity]
old/parseclass/pc.icl [moved from parseclass/pc.icl with 100% similarity]
old/parserParser/test.icl [moved from parserParser/test.icl with 100% similarity]
old/parserParser/testclass.icl [moved from parserParser/testclass.icl with 100% similarity]
old/polycurry/test.icl [moved from polycurry/test.icl with 100% similarity]
old/polymorph-eadt/ext.dcl [moved from polymorph-eadt/ext.dcl with 100% similarity]
old/polymorph-eadt/ext.icl [moved from polymorph-eadt/ext.icl with 100% similarity]
old/polymorph-eadt/main.dcl [moved from polymorph-eadt/main.dcl with 100% similarity]
old/polymorph-eadt/main.icl [moved from polymorph-eadt/main.icl with 100% similarity]
old/profile/a.out Time Profile.pcl [moved from profile/a.out Time Profile.pcl with 100% similarity]
old/profile/callgrind.out.32418 [moved from profile/callgrind.out.32418 with 100% similarity]
old/profile/test.icl [moved from profile/test.icl with 100% similarity]
old/qualified_hidden/test.icl [moved from qualified_hidden/test.icl with 100% similarity]
old/randdist/test.icl [moved from randdist/test.icl with 100% similarity]
old/randdist/testsk [moved from randdist/testsk with 100% similarity]
old/randdist/testsk.icl [moved from randdist/testsk.icl with 100% similarity]
old/randstring/test.icl [moved from randstring/test.icl with 100% similarity]
old/rank2/test.icl [moved from rank2/test.icl with 100% similarity]
old/real_conv/test.icl [moved from real_conv/test.icl with 100% similarity]
old/runtasks/test.dcl [moved from runtasks/test.dcl with 100% similarity]
old/runtasks/test.icl [moved from runtasks/test.icl with 100% similarity]
old/runtime-generic/test.icl [moved from runtime-generic/test.icl with 100% similarity]
old/select/Select.dcl [moved from select/Select.dcl with 100% similarity]
old/sequence_slow/Makefile [moved from sequence_slow/Makefile with 100% similarity]
old/sequence_slow/test.icl [moved from sequence_slow/test.icl with 100% similarity]
old/shared_selection/test.icl [moved from shared_selection/test.icl with 100% similarity]
old/sharestore/test.icl [moved from sharestore/test.icl with 100% similarity]
old/signal/prj [moved from signal/prj with 100% similarity]
old/signal/test.icl [moved from signal/test.icl with 100% similarity]
old/stampedShare/test.icl [moved from stampedShare/test.icl with 100% similarity]
old/stepparallel/test.icl [moved from stepparallel/test.icl with 100% similarity]
old/stimer/Makefile [moved from stimer/Makefile with 100% similarity]
old/stimer/test.icl [moved from stimer/test.icl with 100% similarity]
old/strictlet/test.icl [moved from strictlet/test.icl with 100% similarity]
old/tabbar/test.icl [moved from tabbar/test.icl with 100% similarity]
old/tcp/test.icl [moved from tcp/test.icl with 100% similarity]
old/te/test.icl [moved from te/test.icl with 100% similarity]
old/test.prt [moved from test.prt with 100% similarity]
old/test.txt [moved from test.txt with 100% similarity]
old/test2.icl [moved from test2.icl with 100% similarity]
old/test3.icl [moved from test3.icl with 100% similarity]
old/threadpool/test.icl [moved from threadpool/test.icl with 100% similarity]
old/timegraph/TimeGraph/TimeGraph.dcl [moved from timegraph/TimeGraph/TimeGraph.dcl with 100% similarity]
old/timegraph/TimeGraph/TimeGraph.icl [moved from timegraph/TimeGraph/TimeGraph.icl with 100% similarity]
old/type-restrictions/test.icl [moved from type-restrictions/test.icl with 100% similarity]
shallow.icl [new file with mode: 0644]
struct/struct.icl [deleted file]
test.icl

diff --git a/deep.icl b/deep.icl
new file mode 100644 (file)
index 0000000..5124c43
--- /dev/null
+++ b/deep.icl
@@ -0,0 +1,29 @@
+module deep
+
+import StdEnv
+
+:: DSL
+       = Lit Int
+       | Plus DSL DSL
+       | Div DSL DSL
+
+eval :: DSL -> Int
+eval (Lit i) = i
+eval (Plus x y) = eval x + eval y
+eval (Div x y) = eval x / eval y
+
+//Start = eval (Plus (Lit 41) (Lit 1))
+
+import Control.Applicative
+import Control.Monad
+import Data.Functor
+import Data.Maybe
+
+evalM :: DSL -> Maybe Int
+evalM (Lit i) = pure i
+evalM (Plus x y) = (+) <$> evalM x <*> evalM y
+evalM (Div x y) = evalM x >>= \x->evalM y >>= \y->case y of
+       0 = Nothing
+       x = Just (x / y)
+
+Start = evalM (Plus (Lit 41) (Lit 1))
diff --git a/dep/a.out b/dep/a.out
deleted file mode 100755 (executable)
index 4fba07f..0000000
Binary files a/dep/a.out and /dev/null differ
diff --git a/eadt.icl b/eadt.icl
new file mode 100644 (file)
index 0000000..30ec0e1
--- /dev/null
+++ b/eadt.icl
@@ -0,0 +1,73 @@
+module eadt
+
+import StdEnv
+import Control.Monad
+import Control.Applicative
+import Data.Functor
+import Data.Maybe
+
+:: BM a b = { to :: a -> b, fro :: b -> a}
+bm :: BM a a
+bm = {to=id, fro=id}
+
+class eval m where eval :: (m a) -> Maybe a
+class print m where print :: (m a) [String] -> [String]
+class flat m where flat :: (m a) -> DSL a
+:: DSL a
+       = E.e: Lit (BM e a) a & toString e
+       | E.e: Plus (BM e a) (DSL e) (DSL e) & + e
+       | E.m: Ext (m a) & eval, print, flat m
+lit = Lit bm
+(+.) infixl 6
+(+.) = Plus bm
+
+instance eval DSL where
+       eval (Lit _ a) = Just a
+       eval (Plus bm x y) = bm.to <$> ((+) <$> eval x <*> eval y)
+       eval (Ext m) = eval m
+
+instance print DSL where
+       print (Lit bm a) c = [toString (bm.fro a):c]
+       print (Plus _ x y) c = print x ["+":print y c]
+       print (Ext m) c = print m c
+
+instance flat DSL where
+       flat (Ext m) = Ext (flat m)
+       flat a = a
+
+:: Div a = E.e: Div (BM e a) (DSL e) (DSL e) & /, zero, == e
+(/.) infixl 7
+(/.) x y = Ext (Div bm x y)
+
+instance eval Div where
+       eval (Div bm x y) = bm.to <$> (eval x >>= \x->eval y >>= \y->
+               if (y == zero) Nothing (Just (x/y)))
+
+instance print Div where
+       print (Div bm x y) c = print x ["/":print y c]
+
+instance flat Div where
+       flat a = Ext a
+
+:: In a b = In infix 0 a b
+:: Var a = E.b: Var ((DSL b) -> In (DSL b) (DSL a))
+var = Ext o Var
+instance eval Var where
+       eval (Var def) =
+               let (init In body) = def init
+               in eval body
+
+instance print Var where
+       print (Var def) c =
+               let (init In body) = def init
+               in ["let _ = ":print init [" in ":print body c]]
+
+instance flat Var where
+       flat (Var def) =
+               let (init In body) = def init
+               in body
+
+Start = printEval (var \x=lit 41 In x +. lit 1)
+
+printEval :: (DSL a) -> (Maybe a, [String])
+printEval e = (eval e, print e [])
diff --git a/exeditor/test.icl b/exeditor/test.icl
new file mode 100644 (file)
index 0000000..dc32b37
--- /dev/null
@@ -0,0 +1,112 @@
+module test
+
+import StdEnv
+import Data.Maybe
+import Data.Functor
+import qualified Data.Map as DM
+import iTasks
+import iTasks.Internal.Serialization
+
+:: Box = E.t: Box t & iTask t
+unBox (Box b) :== b
+
+gEq{|Box|} (Box l) (Box r) = dynamicJSONEncode l == dynamicJSONEncode r
+JSONEncode{|Box|} _ c = [dynamicJSONEncode c]
+JSONDecode{|Box|} _ [c:r] = (dynamicJSONDecode c, r)
+JSONDecode{|Box|} _ r = (Nothing, r)
+gText{|Box|} tv ma = maybe [] (gText{|*|} tv o Just) ma
+gEditor{|Box|} = bijectEditorValue fromBox toBox gEditor{|*|}
+
+fromBox :: Box -> Type
+fromBox (Box t) = fromBoxd (dynamic t)
+
+fromBoxd :: Dynamic -> Type
+fromBoxd (a :: ()) = Unit
+fromBoxd (a :: Int) = Int a
+fromBoxd (a :: Bool) = Bool a
+fromBoxd (a :: Real) = Real a
+fromBoxd (a :: String) = String a
+fromBoxd ((a, b) :: (a, b)) = Tuple (fromBoxd (dynamic a)) (fromBoxd (dynamic b))
+fromBoxd ((a, b, c) :: (a, b, c)) = Tuple3 (fromBoxd (dynamic a)) (fromBoxd (dynamic b)) (fromBoxd (dynamic b))
+fromBoxd (a :: Person) = Person a
+
+toBox :: Type -> Box
+toBox (Int a) = Box a
+toBox (Bool a) = Box a
+toBox (Real a) = Box a
+toBox (String a) = Box a
+toBox Unit = Box ()
+toBox (Tuple l r) = case (toBox l, toBox r) of
+       (Box l, Box r) = Box (l, r)
+toBox (Tuple3 l m r) = case (toBox l, toBox m, toBox r) of
+       (Box l, Box m, Box r) = Box (l, m, r)
+toBox (Person p) = Box p
+       /*
+gEditor{|Box|} =
+       { Editor
+       | genUI = \uia dp em vst->case em of
+               Enter = (Error "enterInformation not possible for existentials (genUI)", vst)
+               (View b=:(Box a)) = case (castEditor a).Editor.genUI uia dp (View a) vst of
+                       (Error e, vst) = (Error e, vst)
+                       (Ok (ui, es), vst) = (Ok (ui, AnnotatedState (dynamicJSONEncode (View (), uia, b)) es), vst)
+               (Update b=:(Box a)) = case (castEditor a).Editor.genUI uia dp (Update a) vst of
+                       (Error e, vst) = (Error e, vst)
+                       (Ok (ui, es), vst) = (Ok (ui, AnnotatedState (dynamicJSONEncode (Update (), uia, b)) es), vst)
+       , onEdit = \dp dpn es vst->case es of
+               AnnotatedState ebox es = case dynamicJSONDecode ebox of
+                       Just (Enter, _, Box b) = case (castEditor b).Editor.onEdit dp dpn es vst of
+                                       (Error e, vst) = (Error e, vst)
+                                       (Ok (ui, es), vst) = (Ok (ui, AnnotatedState ebox es), vst)
+                       Just (View (), _, Box b) = case (castEditor b).Editor.onEdit dp dpn es vst of
+                                       (Error e, vst) = (Error e, vst)
+                                       (Ok (ui, es), vst) = (Ok (ui, AnnotatedState ebox es), vst)
+                       Just (Update (), _, Box b) = case (castEditor b).Editor.onEdit dp dpn es vst of
+                                       (Error e, vst) = (Error e, vst)
+                                       (Ok (ui, es), vst) = (Ok (ui, AnnotatedState ebox es), vst)
+                       Nothing = (Error "corrupt editor state in Box", vst)
+               _ = (Error "corrupt editor state in Box", vst)
+       , onRefresh = \dp b=:(Box nb) es vst->case es of
+               AnnotatedState box es = case dynamicJSONDecode box of
+                       Just (View (), uia, Box _) = case (castEditor nb).Editor.genUI uia dp (View nb) vst of
+                               (Ok (ui, es), vst) = (Ok (ReplaceUI ui, AnnotatedState (dynamicJSONEncode (View (), uia, b)) es), vst)
+                               (Error e, vst) = (Error e, vst)
+                       Just (Update (), uia, Box _) = case (castEditor nb).Editor.genUI uia dp (Update nb) vst of
+                               (Ok (ui, es), vst) = (Ok (ReplaceUI ui, AnnotatedState (dynamicJSONEncode (Update (), uia, b)) es), vst)
+                               (Error e, vst) = (Error e, vst)
+                       Just (Enter, uia, Box _) = case (castEditor nb).Editor.genUI uia dp (Update nb) vst of
+                               (Ok (ui, es), vst) = (Ok (ReplaceUI ui, AnnotatedState (dynamicJSONEncode (Update (), uia, b)) es), vst)
+                               (Error e, vst) = (Error e, vst)
+                       Nothing = (Error "corrupt editor state in Box", vst)
+               _ = (Error "corrupt editor state in Box", vst)
+       , valueFromState = \es->case es of
+               AnnotatedState box es = case dynamicJSONDecode box of
+                       Just (_, _, Box a) = case (castEditor a).Editor.valueFromState es of
+                               Just a = Just (Box a)
+                               Nothing = Nothing
+                       Nothing = Nothing
+       }
+where
+       castEditor :: t -> Editor t | gEditor{|*|} t
+       castEditor _ = gEditor{|*|}
+*/
+
+Start w = doTasks t w
+
+//t = updateSharedInformation [] (Box 42)
+t = withShared (Box 42) \bs->
+       updateSharedInformation [] bs
+       -|| updateSharedInformation [] bs
+
+:: Type
+       = Int Int
+       | Bool Bool
+       | String String
+       | Real Real
+       | Unit
+       | List [Type]
+       | Tuple Type Type
+       | Tuple3 Type Type Type
+       | Person Person
+:: Person = {firstName :: String, lastName :: String}
+
+derive class iTask Type, Person
diff --git a/foreign/test.c b/foreign/test.c
deleted file mode 100644 (file)
index 586ac74..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stdio.h>
-
-extern int fac(int n);
-
-int cmain()
-{
-       for(int i = 0; i<10; i++)
-               printf("Fac %d: %d\n", i, fac(i));
-}
diff --git a/gopt/gopt.icl b/gopt/gopt.icl
deleted file mode 100644 (file)
index 09089ab..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-module gopt
-
-import StdEnv, StdGeneric
-
-import Data.List
-import Data.Error
-import Data.Func
-import Data.Functor
-import Data.Tuple
-import Data.Maybe
-import Control.Applicative
-import Control.Monad => qualified join
-import System.CommandLine
-import Text
-
-:: Opt a
-       = BinaryFlag (a -> a) (a -> a)
-       | Flags [(String, ([String] a -> (MaybeError [String] (a, [String]))))]
-       | Positionals [(String, String a -> (MaybeError [String] a))]
-       | SubParsers [(String, Opt a)]
-
-class bifmap m :: (a -> b) (b -> a) (m b) -> m a
-instance bifmap Opt
-where
-       bifmap fr to (BinaryFlag set unset) = BinaryFlag (to o set o fr) (to o unset o fr)
-       bifmap fr to (Flags fs) = Flags $ map (appSnd $ (\f s->fm (appFst to) o f s o fr)) fs
-       bifmap fr to (Positionals fs) = Positionals $ map (appSnd $ fmap $ \f->fm to o f o fr) fs
-       bifmap fr to (SubParsers sp) = SubParsers $ map (appSnd (bifmap fr to)) sp
-
-fm f (Ok a) = Ok (f a)
-fm f (Error e) = Error e
-
-combine sel app p s t = p s (sel t) >>= \l->pure (app (const l) t)
-combine` sel app p s t = p s (sel t) >>= \(l, as)->pure ((app (const l) t), as)
-
-ar0 s f as = Ok o flip tuple as o f
-
-generic gopt a *! :: Opt a
-//generic gopt a :: Opt a
-gopt{|Bool|} = BinaryFlag (const True) (const False)
-gopt{|Int|} = Positionals [("INT", \s _->if (and [isDigit c\\c<-:s]) (Ok $ toInt s) (Error ["Not an integer"]))]
-gopt{|Char|} = Positionals [("CHAR", \s _->if (size s == 1) (Ok s.[0]) (Error ["Not a single character"]))]
-gopt{|String|} = Positionals [("STRING", \s _->Ok s)]
-gopt{|RECORD|} f = bifmap (\(RECORD a)->a) (\x->RECORD x) f
-gopt{|OBJECT|} f = bifmap (\(OBJECT a)->a) (\x->OBJECT x) f
-gopt{|FIELD of {gfd_name}|} f = case f of
-       //Child is a boolean
-       BinaryFlag set unset = mapF $ Flags [(gfd_name, ar0 gfd_name set), ("no-" +++ gfd_name, ar0 ("no-" +++ gfd_name) unset)]
-       //Child is a basic value or a tuple
-       Positionals ps = mapF $ Flags [(gfd_name, ptoarg ps)]
-       //Child is another record, make the arguments ddstyle TODO
-       Flags x = mapF (Flags x)
-       //Child is a subparser
-       SubParsers ps = mapF (Flags [(gfd_name, pOpts (SubParsers ps))])
-       x = abort "Subparsers not supported"
-where
-       mapF :: ((m a) -> m (FIELD a)) | bifmap m
-       mapF = bifmap (\(FIELD a)->a) (\x->FIELD x)
-
-       ptoarg [p] [] i = Error ["Not enough arguments for " +++ gfd_name]
-       ptoarg [(_, p):ps] [a:as] i = p a i >>= ptoarg ps as
-       ptoarg [] as i = Ok (i, as)
-gopt{|PAIR|} l r = case (l, r) of
-       (Positionals pl, Positionals pr)
-               = Positionals
-                       $  map (appSnd $ combine PFst appPFst) pl
-                       ++ map (appSnd $ combine PSnd appPSnd) pr
-       (Flags fl, Flags fr)
-               = Flags
-                       $  map (appSnd $ combine` PFst appPFst) fl
-                       ++ map (appSnd $ combine` PSnd appPSnd) fr
-       (x, y) = abort $ "gopt{|PAIR|}: " +++ consPrint x +++ " " +++ consPrint y
-where
-       appPFst f (PAIR x y) = PAIR (f x) y
-       appPSnd f (PAIR x y) = PAIR x (f y)
-       PFst (PAIR x y) = x
-       PSnd (PAIR x y) = y
-gopt{|UNIT|} = Positionals []
-gopt{|CONS of {gcd_name}|} c = bifmap (\(CONS a)->a) CONS $ SubParsers [(gcd_name, c)]
-gopt{|EITHER|} l r = case (l, r) of
-       (SubParsers sl, SubParsers sr)
-               = SubParsers
-                       $  map (appSnd $ bifmap (\(LEFT a)->a) LEFT) sl
-                       ++ map (appSnd $ bifmap (\(RIGHT a)->a) RIGHT) sr
-gopt{|(,)|} l r = case (l, r) of
-       (Positionals pl, Positionals pr)
-               = Positionals
-                       $  map (appSnd $ combine fst appFst) pl
-                       ++ map (appSnd $ combine snd appSnd) pr
-gopt{|(,,)|} f s t = case (f, s, t) of
-       (Positionals pf, Positionals ps, Positionals pt)
-               = Positionals
-                       $  map (appSnd $ combine fst3 appFst3) pf
-                       ++ map (appSnd $ combine snd3 appSnd3) ps
-                       ++ map (appSnd $ combine thd3 appThd3) pt
-
-consPrint (Positionals x) = "Positionals"
-consPrint (BinaryFlag x _) = "BinaryFlag"
-consPrint (Flags x) = "Flags"
-consPrint (SubParsers x) = "SubParsers"
-
-parseOpts :: [String] a -> MaybeError [String] (a, [String]) | gopt{|*|} a
-parseOpts args a = pOpts gopt{|*|} args a
-
-pOpts :: (Opt a) [String] a -> MaybeError [String] (a, [String])
-pOpts (Positionals [p:ps]) [] a = Error [toString (length [p:ps]) +++ " positional arguments required"]
-pOpts (Positionals [p:ps]) [arg:args] a = (snd p) arg a >>= pOpts (Positionals ps) args
-pOpts (SubParsers ps) [arg:args] a = case find (\(l,p)->l==arg) ps of
-       Nothing = Error ["Unrecognized subcommand"]
-       Just (l, p) = pOpts p args a
-pOpts (SubParsers ps) [] a = Error ["One of these subcommands required: " +++ join ", " (map fst ps)]
-pOpts (Flags fs) [arg:args] a
-       | not (startsWith "--" arg) = Ok (a, [arg:args])
-       = case find (\(l,p)->"--" +++ l == arg) fs of
-               Nothing = Error ["Unrecognized option: " +++ arg]
-               Just (l, p) = p args a >>= \(a, args)->pOpts (Flags fs) args a
-pOpts (BinaryFlag yes no) args a
-       = pOpts (Positionals [("BOOL", \s v->
-               if (s == "True")
-                       (Ok (yes v))
-                       (if (s == "False")
-                               (Ok (no v))
-                               (Error ["Not True or False"])
-                       )
-       )]) args a
-pOpts t args a = Ok (a, args)
-
-pHelp :: (Opt a) -> [String]
-pHelp (Positionals []) = []
-pHelp (Positionals [(i, _):ps]) = [i, " ":pHelp $ Positionals ps]
-pHelp (SubParsers ps) =
-       flatten
-       [[n, " ":pHelp opt] ++ ["\n"]
-       \\(n, opt)<-ps
-       ]
-pHelp (Flags fs) =
-       ["Flags\n"
-       :
-               flatten
-               [["--",f, "\n"]
-               \\(f, p)<-fs
-               ]
-       ]
-
-:: T =
-       { field  :: (Int,Int)
-       , field2 :: String
-       , t2 :: C
-       }
-:: T2 = {f :: Int, f2 :: Bool}
-:: C = A Int | B | C Bool
-
-:: ADT
-       = ADT1
-       | ADT2 Int String
-
-derive binumap Opt, [], (,), MaybeError
-derive gopt T, T2, ADT, C
-
-Start w
-# ([argv0:args], w) = getCommandLine w
-//= pHelp opt
-= parseOpts args {field=(0, 0),field2="",t2=A 4}
-
-opt :: Opt T
-opt = gopt{|*|}
similarity index 100%
rename from 7gui/test.icl
rename to old/7gui/test.icl
similarity index 100%
rename from TimeGraph.zip
rename to old/TimeGraph.zip
similarity index 100%
rename from abc/test.icl
rename to old/abc/test.icl
similarity index 100%
rename from afp/a1/a.icl
rename to old/afp/a1/a.icl
diff --git a/old/afp/a10/a10 b/old/afp/a10/a10
new file mode 100755 (executable)
index 0000000..3d39c53
Binary files /dev/null and b/old/afp/a10/a10 differ
similarity index 100%
rename from afp/a10/a10.icl
rename to old/afp/a10/a10.icl
similarity index 100%
rename from afp/a10/setGADT.icl
rename to old/afp/a10/setGADT.icl
similarity index 100%
rename from afp/a11/a11.icl
rename to old/afp/a11/a11.icl
similarity index 100%
rename from afp/a2/a2.icl
rename to old/afp/a2/a2.icl
similarity index 100%
rename from afp/a2/a2a.icl
rename to old/afp/a2/a2a.icl
similarity index 100%
rename from afp/a5/a5
rename to old/afp/a5/a5
similarity index 100%
rename from afp/a5/a5.icl
rename to old/afp/a5/a5.icl
similarity index 100%
rename from afp/a6/a7.icl
rename to old/afp/a6/a7.icl
similarity index 100%
rename from afp/a7/a7.icl
rename to old/afp/a7/a7.icl
diff --git a/old/afp/a8/a8 b/old/afp/a8/a8
new file mode 100755 (executable)
index 0000000..b74cd52
Binary files /dev/null and b/old/afp/a8/a8 differ
similarity index 100%
rename from afp/a8/a8.icl
rename to old/afp/a8/a8.icl
similarity index 100%
rename from afp/a8/a8_old.icl
rename to old/afp/a8/a8_old.icl
diff --git a/old/afp/a9/a8 b/old/afp/a9/a8
new file mode 100755 (executable)
index 0000000..b74cd52
Binary files /dev/null and b/old/afp/a9/a8 differ
diff --git a/old/afp/a9/a9 b/old/afp/a9/a9
new file mode 100755 (executable)
index 0000000..b9f77f5
Binary files /dev/null and b/old/afp/a9/a9 differ
similarity index 100%
rename from afp/a9/a9.icl
rename to old/afp/a9/a9.icl
similarity index 100%
rename from alacarte/calc.icl
rename to old/alacarte/calc.icl
similarity index 100%
rename from append-ed/Makefile
rename to old/append-ed/Makefile
similarity index 100%
rename from append-ed/test.icl
rename to old/append-ed/test.icl
similarity index 100%
rename from array_fun/test.icl
rename to old/array_fun/test.icl
similarity index 100%
rename from array_itasks/T.dcl
rename to old/array_itasks/T.dcl
similarity index 100%
rename from base64/test.icl
rename to old/base64/test.icl
similarity index 100%
rename from benchmark/test.icl
rename to old/benchmark/test.icl
similarity index 100%
rename from benchmark/test.sh
rename to old/benchmark/test.sh
similarity index 100%
rename from booking/Booking
rename to old/booking/Booking
similarity index 100%
rename from booking/Booking.icl
rename to old/booking/Booking.icl
similarity index 100%
rename from booking/test.icl
rename to old/booking/test.icl
similarity index 100%
rename from bug/t.icl
rename to old/bug/t.icl
similarity index 100%
rename from bugs/test.icl
rename to old/bugs/test.icl
similarity index 100%
rename from choose/Makefile
rename to old/choose/Makefile
similarity index 100%
rename from choose/test.icl
rename to old/choose/test.icl
similarity index 100%
rename from cleanup/test.icl
rename to old/cleanup/test.icl
similarity index 100%
rename from cli/test.icl
rename to old/cli/test.icl
similarity index 100%
rename from codegenbug/test.icl
rename to old/codegenbug/test.icl
similarity index 100%
rename from contparse/test.icl
rename to old/contparse/test.icl
similarity index 100%
rename from csg/p.icl
rename to old/csg/p.icl
similarity index 100%
rename from deep-var/eval.dcl
rename to old/deep-var/eval.dcl
similarity index 100%
rename from deep-var/eval.icl
rename to old/deep-var/eval.icl
similarity index 100%
rename from deep-var/pprint
rename to old/deep-var/pprint
similarity index 100%
rename from deep-var/pprint.dcl
rename to old/deep-var/pprint.dcl
similarity index 100%
rename from deep-var/pprint.icl
rename to old/deep-var/pprint.icl
similarity index 100%
rename from deep-var/test.dcl
rename to old/deep-var/test.dcl
similarity index 100%
rename from deep-var/test.icl
rename to old/deep-var/test.icl
similarity index 100%
rename from dep/test.icl
rename to old/dep/test.icl
similarity index 100%
rename from documents/Makefile
rename to old/documents/Makefile
similarity index 100%
rename from documents/test.icl
rename to old/documents/test.icl
similarity index 100%
rename from dsl/dsl.icl
rename to old/dsl/dsl.icl
similarity index 100%
rename from dupworld/test.icl
rename to old/dupworld/test.icl
similarity index 100%
rename from dyn/Makefile
rename to old/dyn/Makefile
similarity index 100%
rename from dyn/T.dcl
rename to old/dyn/T.dcl
similarity index 100%
rename from dyn/T.icl
rename to old/dyn/T.icl
similarity index 100%
rename from dyn/test.icl
rename to old/dyn/test.icl
similarity index 100%
rename from eadt/Mul.dcl
rename to old/eadt/Mul.dcl
similarity index 100%
rename from eadt/Mul.icl
rename to old/eadt/Mul.icl
similarity index 100%
rename from eadt/Sub.dcl
rename to old/eadt/Sub.dcl
similarity index 100%
rename from eadt/Sub.icl
rename to old/eadt/Sub.icl
similarity index 100%
rename from eadt/T.dcl
rename to old/eadt/T.dcl
similarity index 100%
rename from eadt/T.icl
rename to old/eadt/T.icl
similarity index 100%
rename from eadt/export/B.dcl
rename to old/eadt/export/B.dcl
similarity index 100%
rename from eadt/export/B.icl
rename to old/eadt/export/B.icl
similarity index 100%
rename from eadt/export/C.dcl
rename to old/eadt/export/C.dcl
similarity index 100%
rename from eadt/export/C.icl
rename to old/eadt/export/C.icl
similarity index 100%
rename from eadt/main.dcl
rename to old/eadt/main.dcl
similarity index 100%
rename from eadt/main.icl
rename to old/eadt/main.icl
similarity index 100%
rename from eadt/test.icl
rename to old/eadt/test.icl
similarity index 100%
rename from expr/class
rename to old/expr/class
similarity index 100%
rename from expr/class.dcl
rename to old/expr/class.dcl
similarity index 100%
rename from expr/class.icl
rename to old/expr/class.icl
similarity index 100%
rename from expr/deep
rename to old/expr/deep
similarity index 100%
rename from expr/deep.icl
rename to old/expr/deep.icl
similarity index 100%
rename from expr/exist/exist
rename to old/expr/exist/exist
similarity index 100%
rename from expr/expr.md
rename to old/expr/expr.md
similarity index 100%
rename from expr/gadt
rename to old/expr/gadt
similarity index 100%
rename from expr/gadt.icl
rename to old/expr/gadt.icl
similarity index 100%
rename from expr/shallow
rename to old/expr/shallow
similarity index 100%
rename from expr/shallow.icl
rename to old/expr/shallow.icl
similarity index 100%
rename from exprparse/test.icl
rename to old/exprparse/test.icl
similarity index 100%
rename from expruniq/uexpr.icl
rename to old/expruniq/uexpr.icl
similarity index 100%
rename from ext/test.dcl
rename to old/ext/test.dcl
similarity index 100%
rename from ext/test.icl
rename to old/ext/test.icl
similarity index 100%
rename from filepicker/prj
rename to old/filepicker/prj
similarity index 100%
rename from filepicker/test.icl
rename to old/filepicker/test.icl
similarity index 100%
rename from foreign/Makefile
rename to old/foreign/Makefile
similarity index 100%
rename from foreign/fac.dcl
rename to old/foreign/fac.dcl
similarity index 100%
rename from foreign/fac.icl
rename to old/foreign/fac.icl
similarity index 100%
rename from foreign/test.dcl
rename to old/foreign/test.dcl
similarity index 100%
rename from foreign/test.icl
rename to old/foreign/test.icl
similarity index 100%
rename from fullscreen/Makefile
rename to old/fullscreen/Makefile
similarity index 100%
rename from fullscreen/test.icl
rename to old/fullscreen/test.icl
similarity index 100%
rename from fun/test.icl
rename to old/fun/test.icl
similarity index 100%
rename from funcdeps/test.icl
rename to old/funcdeps/test.icl
similarity index 100%
rename from gast-der/test.icl
rename to old/gast-der/test.icl
similarity index 100%
rename from gast-der/testnf
rename to old/gast-der/testnf
similarity index 100%
rename from gen/test.icl
rename to old/gen/test.icl
similarity index 100%
rename from gencons/Makefile
rename to old/gencons/Makefile
similarity index 100%
rename from gencons/test.icl
rename to old/gencons/test.icl
similarity index 100%
rename from gentests/test.icl
rename to old/gentests/test.icl
similarity index 100%
rename from haye_test/test.icl
rename to old/haye_test/test.icl
similarity index 100%
rename from hex/hex.icl
rename to old/hex/hex.icl
similarity index 100%
rename from if/Makefile
rename to old/if/Makefile
similarity index 100%
rename from if/test.icl
rename to old/if/test.icl
similarity index 100%
rename from infdomain/test.icl
rename to old/infdomain/test.icl
similarity index 100%
rename from iot/test.icl
rename to old/iot/test.icl
similarity index 100%
rename from jsonmap/test.icl
rename to old/jsonmap/test.icl
similarity index 100%
rename from lat/test.icl
rename to old/lat/test.icl
similarity index 100%
rename from letrec/test.icl
rename to old/letrec/test.icl
similarity index 100%
rename from library/test.icl
rename to old/library/test.icl
similarity index 100%
rename from linker/test.icl
rename to old/linker/test.icl
similarity index 100%
rename from list_types/test.icl
rename to old/list_types/test.icl
similarity index 100%
rename from macros/test.icl
rename to old/macros/test.icl
similarity index 100%
rename from macros/test.log
rename to old/macros/test.log
similarity index 100%
rename from metaeditor/ed.icl
rename to old/metaeditor/ed.icl
similarity index 100%
rename from onclick/test.icl
rename to old/onclick/test.icl
similarity index 100%
rename from paard.icl
rename to old/paard.icl
similarity index 100%
rename from parseclass/expr.icl
rename to old/parseclass/expr.icl
similarity index 100%
rename from parseclass/pc.icl
rename to old/parseclass/pc.icl
similarity index 100%
rename from polycurry/test.icl
rename to old/polycurry/test.icl
similarity index 100%
rename from profile/test.icl
rename to old/profile/test.icl
similarity index 100%
rename from randdist/test.icl
rename to old/randdist/test.icl
similarity index 100%
rename from randdist/testsk
rename to old/randdist/testsk
similarity index 100%
rename from randdist/testsk.icl
rename to old/randdist/testsk.icl
similarity index 100%
rename from randstring/test.icl
rename to old/randstring/test.icl
similarity index 100%
rename from rank2/test.icl
rename to old/rank2/test.icl
similarity index 100%
rename from real_conv/test.icl
rename to old/real_conv/test.icl
similarity index 100%
rename from runtasks/test.dcl
rename to old/runtasks/test.dcl
similarity index 100%
rename from runtasks/test.icl
rename to old/runtasks/test.icl
similarity index 100%
rename from select/Select.dcl
rename to old/select/Select.dcl
similarity index 100%
rename from sharestore/test.icl
rename to old/sharestore/test.icl
similarity index 100%
rename from signal/prj
rename to old/signal/prj
similarity index 100%
rename from signal/test.icl
rename to old/signal/test.icl
similarity index 100%
rename from stimer/Makefile
rename to old/stimer/Makefile
similarity index 100%
rename from stimer/test.icl
rename to old/stimer/test.icl
similarity index 100%
rename from strictlet/test.icl
rename to old/strictlet/test.icl
similarity index 100%
rename from tabbar/test.icl
rename to old/tabbar/test.icl
similarity index 100%
rename from tcp/test.icl
rename to old/tcp/test.icl
similarity index 100%
rename from te/test.icl
rename to old/te/test.icl
similarity index 100%
rename from test.prt
rename to old/test.prt
similarity index 100%
rename from test.txt
rename to old/test.txt
similarity index 100%
rename from test2.icl
rename to old/test2.icl
similarity index 100%
rename from test3.icl
rename to old/test3.icl
similarity index 100%
rename from threadpool/test.icl
rename to old/threadpool/test.icl
diff --git a/shallow.icl b/shallow.icl
new file mode 100644 (file)
index 0000000..aeffa23
--- /dev/null
@@ -0,0 +1,8 @@
+module shallow
+
+import StdEnv
+
+:: DSL = DSL a
+
+lit :: a -> DSL a
+lit a = ...
diff --git a/struct/struct.icl b/struct/struct.icl
deleted file mode 100644 (file)
index f5cb346..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-module struct
-
-import StdEnv
-import StdGeneric
-import StdDebug
-
-import Text
-
-import Data.Functor
-import Control.Applicative
-
-toEnumValue :: GenericConsDescriptor -> String
-toEnumValue gcd = gcd.gcd_type_def.gtd_name +++ "_" +++ gcd.gcd_name
-
-toEnumType :: GenericTypeDefDescriptor -> String
-toEnumType gtd = "enum cleanc_" +++ gtd.gtd_name
-
-class gGenerateC a | gToCType{|*|}, gToCValue{|*|}, gToCEnums{|*|} a
-
-:: CInfo a = {header :: String , toValue :: a -> String}
-
-generateCInfo :: CInfo a | gGenerateC a
-generateCInfo =
-       let
-               (CEnums enums) = cast res gToCEnums{|*|}
-               (SM types) = cast res gToCType{|*|}
-               res =
-                       { header = concat
-                               [ join "\n" (removeDup (sort enums))
-                               , "\n\n"
-                               , concat (types {fresh=0,inRecord=False,indent=0} [])
-                               , ";"
-                               ]
-                       , toValue = \a->concat (gToCValue{|*|} a [])
-                       }
-       in res
-where
-       cast :: (v a) -> ((w a) -> w a)
-       cast _ = id
-
-generic gToCType a :: Structmaker a
-:: Structmaker a = SM (SData [String] -> [String]) | StructMakerOnzin a
-:: SData = {indent :: Int, fresh :: Int, inRecord :: Bool}
-indent s c = [createArray s.indent '\t':c]
-show str s c = indent s [str:c]
-
-gToCType{|Int|}  = SM (show "uint64_t")
-gToCType{|Real|} = SM (show "double") 
-gToCType{|Bool|} = SM (show "bool")
-gToCType{|UNIT|} = SM \_->id
-gToCType{|EITHER|} (SM fl) (SM fr) = SM \s->fl s o fr s
-gToCType{|PAIR|} (SM fl) (SM fr)
-        = SM \s c
-               | s.inRecord = fl s (fr s c)
-               = fl s [" f", toString s.fresh, ";\n":fr {s & fresh=s.fresh+1} c]
-gToCType{|OBJECT of gtd|} (SM f)
-       //Newtype
-       | gtd.gtd_num_conses == 0 = SM f
-       = SM \s c
-               //Enumeration (no data)
-               | and [gcd.gcd_arity == 0\\gcd<-gtd.gtd_conses] = indent s [toEnumType gtd:c]
-               //Regular ADTs
-               # s` = {s & indent = s.indent + 1}
-               = indent s ["struct clean_", gtd.gtd_name, " {\n":
-                       indent s` [toEnumType gtd, " cons;\n":
-                       indent s` ["union {\n":
-                       f {s` & indent=s`.indent+1, inRecord=False} (indent s` ["} data;\n":
-                       indent s ["}":c]])]]]
-gToCType{|CONS of gcd|} (SM f)
-       //No data field
-       | gcd.gcd_arity == 0 = SM \_->id
-       //Only one data field
-       | gcd.gcd_arity == 1 = SM \s c->f s [" ", gcd.gcd_name, ";\n":c]
-       = SM \s c->indent s ["struct {\n":f {s & indent=s.indent+1} [" f", toString (gcd.gcd_arity - 1), ";\n":indent s ["} ", gcd.gcd_name, ";\n":c]]]
-gToCType{|RECORD of grd|} (SM f)
-       = SM \s c->indent s ["struct clean_", grd.grd_name, " {\n": f {s & indent=s.indent+1, inRecord=True} (indent s ["}":c])]
-gToCType{|FIELD of gfd|} (SM f) = SM \s c->f s [" ", gfd.gfd_name,";\n":c]
-
-:: CEnums a = CEnums [String] | CEnumsOnzin a
-generic gToCEnums a :: CEnums a
-gToCEnums{|a|} = CEnums []
-gToCEnums{|UNIT|} = CEnums []
-gToCEnums{|EITHER|} (CEnums fl) (CEnums fr) = CEnums (fl ++ fr)
-gToCEnums{|PAIR|} (CEnums fl) (CEnums fr) = CEnums (fl ++ fr)
-gToCEnums{|OBJECT of gtd|} (CEnums f) = CEnums [concat [toEnumType gtd, " {", join ", " (map toEnumValue gtd.gtd_conses), "};"]:f]
-gToCEnums{|CONS|} (CEnums f) = CEnums f
-gToCEnums{|RECORD|} (CEnums f) = CEnums f
-gToCEnums{|FIELD|} (CEnums f) = CEnums f
-
-generic gToCValue a :: a [String] -> [String]
-gToCValue{|Int|} i c = [toString i:c]
-gToCValue{|Real|} r c = [toString r:c]
-gToCValue{|Bool|} b c = [if b "true" "false":c]
-gToCValue{|UNIT|} _ _ = []
-gToCValue{|EITHER|} fl _ (LEFT l) c = fl l c
-gToCValue{|EITHER|} _ fr (RIGHT l) c = fr l c
-gToCValue{|PAIR|} fl fr (PAIR l r) c = fl l [", ":fr r c]
-gToCValue{|OBJECT of gtd|} f (OBJECT a) c
-       //Newtype
-       | gtd.gtd_num_conses == 0 = f a c
-       | and [gcd.gcd_arity == 0\\gcd<-gtd.gtd_conses] = f a c
-       = ["{":f a ["}":c]]
-gToCValue{|CONS of gcd|} f (CONS a) c
-       //No data field
-       | gcd.gcd_arity == 0 = [toEnumValue gcd:c]
-       | gcd.gcd_arity == 1 = [" .cons=",toEnumValue gcd,", .data.",gcd.gcd_name,"=":f a c]
-       = [" .cons=",toEnumValue gcd,", .data.",gcd.gcd_name,"={":f a ["} ":c]]
-gToCValue{|RECORD|} f (RECORD a) c = ["{":f a ["}":c]]
-gToCValue{|FIELD of gfd|} f (FIELD a) c = [" .", gfd.gfd_name, "=": f a c]
-
-:: DHTDetails
-       = DHT Int Bool
-       | SHT Addr
-       | XXX Int Int Int
-       | XXY Int Int DHTType
-
-:: Addr =: Addr Int
-
-:: DHTType = DHT11 | DHT12 | DHT22
-
-derive class gGenerateC DHTDetails, DHTType, Addr, Record
-
-Start :: CInfo Record
-Start = generateCInfo
-
-:: Record =
-       { field1 :: Int
-       , field2 :: Bool
-       , field3 :: DHTType
-       , field4 :: DHTDetails
-       }
index 2350a9a..822f41d 100644 (file)
--- a/test.icl
+++ b/test.icl
@@ -1,52 +1,38 @@
 module test
 
-import StdEnv, StdGeneric
-import Data.Array
-
-Start :: [{!Int}]
-Start =
-       [ appendArr {!1,2,3} {!4,5,6,7}
-       , appendArr {!} {!}
-       , appendArr {!} {!1,2,3}
-       , appendArr {!1,2,3} {!}
-       ]
-/*
-derive bimap Box
-
-:: Box b a =: Box b
-
-unBox (Box b) :== b
-box b :== Box b
-
-generic gPotentialInf a :: [String] -> Box Bool a
-
-gPotentialInf{|World|} _ = box False
-gPotentialInf{|File|} _ = box False
-gPotentialInf{|Bool|} _ = box False
-gPotentialInf{|Char|} _ = box False
-gPotentialInf{|Real|} _ = box False
-gPotentialInf{|Int|} _ = box False
-gPotentialInf{|Dynamic|} _ = box False
-gPotentialInf{|(->)|} _ _ _ = box False
-gPotentialInf{|{}|} a m = box (unBox (a m))
-gPotentialInf{|{!}|} a m = box (unBox (a m))
-gPotentialInf{|{#}|} a m = box (unBox (a m))
-gPotentialInf{|UNIT|} _ = box False
-gPotentialInf{|EITHER|} l r m = box (unBox (l m) || unBox (r m))
-gPotentialInf{|PAIR|} l r m = box (unBox (l m) || unBox (r m))
-gPotentialInf{|CONS|} x m = box (unBox (x m))
-gPotentialInf{|FIELD|} x m = box (unBox (x m))
-gPotentialInf{|RECORD of {grd_name}|} x m
-       | isMember grd_name m = box True
-       = box (unBox (x [grd_name:m]))
-gPotentialInf{|OBJECT of {gtd_name}|} x m
-       | isMember gtd_name m = box True
-       = box (unBox (x [gtd_name:m]))
-
-//derive gPotentialInf Int,Bool,Char,Real,String,File,World,Dynamic
-derive gPotentialInf (),(,),(,,),(,,,),(,,,,),(,,,,,),(,,,,,,),(,,,,,,,),(,,,,,,,,),(,,,,,,,,,),(,,,,,,,,,,),(,,,,,,,,,,,),(,,,,,,,,,,,,),(,,,,,,,,,,,,,),(,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
-derive gPotentialInf {},{#},{!},[],[! ],[ !],[!!],[#],[#!]
-
-Start :: Box Bool *File
-Start = gPotentialInf{|*|} []
-*/
+import StdEnv
+import Data.Maybe
+import Data.Functor
+import Control.Monad
+import Control.Applicative
+
+class expr v where
+       lit :: i -> v i | toString i
+       (+.) infixl 6 :: (v i) (v i) -> v i | + i
+
+instance + (v a) | expr v & + a where
+       + l r = l +. r
+
+eval :: (Maybe a) -> Maybe a
+eval x = x
+instance expr Maybe where
+       lit i = Just i
+       +. x y = (+) <$> x <*> y
+
+:: Print a =: Print String
+print :: (Print a) -> String
+print (Print a) = a
+instance expr Print where
+       lit i = Print (toString i)
+       +. (Print l) (Print r) = Print (l +++ "+" +++ r)
+
+printEval :: (A.v: v a | expr v) -> (Maybe a, String)
+//printEval f = (f, let (Print p) = f in p)
+printEval f = (eval f, print f)
+
+//Mag niet
+//Start :: (Maybe Int, String)
+//Start = printEval (lit 4 + lit 38)
+
+//Mag wel
+Start = let (Print f) = lit 4 + lit 38 in f