Merge branch 'master' of git.martlubbers.net:clean-tests
authorMart Lubbers <mart@martlubbers.net>
Thu, 23 Aug 2018 16:48:06 +0000 (18:48 +0200)
committerMart Lubbers <mart@martlubbers.net>
Thu, 23 Aug 2018 16:48:06 +0000 (18:48 +0200)
14 files changed:
abstract-newtypes/nt.dcl [new file with mode: 0644]
abstract-newtypes/nt.icl [new file with mode: 0644]
cli/test.icl [new file with mode: 0644]
deep-var/eval.dcl [new file with mode: 0644]
deep-var/eval.icl [new file with mode: 0644]
deep-var/pprint [new file with mode: 0755]
deep-var/pprint.dcl [new file with mode: 0644]
deep-var/pprint.icl [new file with mode: 0644]
deep-var/test.dcl [new file with mode: 0644]
deep-var/test.icl [new file with mode: 0644]
lat/test.icl [new file with mode: 0644]
overloading_tc/test.icl [new file with mode: 0644]
runtime-generic/test.icl [new file with mode: 0644]
strictlet/test.icl [new file with mode: 0644]

diff --git a/abstract-newtypes/nt.dcl b/abstract-newtypes/nt.dcl
new file mode 100644 (file)
index 0000000..956b15b
--- /dev/null
@@ -0,0 +1,4 @@
+definition module nt
+
+:: NT a
+:: RT a
diff --git a/abstract-newtypes/nt.icl b/abstract-newtypes/nt.icl
new file mode 100644 (file)
index 0000000..627578f
--- /dev/null
@@ -0,0 +1,4 @@
+implementation module nt
+
+:: NT a =: NT a
+:: RT a = RT a
diff --git a/cli/test.icl b/cli/test.icl
new file mode 100644 (file)
index 0000000..1f2059f
--- /dev/null
@@ -0,0 +1,4 @@
+module test
+
+Start :: [Char] -> [Char]
+Start cs = cs
diff --git a/deep-var/eval.dcl b/deep-var/eval.dcl
new file mode 100644 (file)
index 0000000..d3397a5
--- /dev/null
@@ -0,0 +1,5 @@
+definition module eval
+
+from test import :: DSL
+
+eval :: DSL -> Int
diff --git a/deep-var/eval.icl b/deep-var/eval.icl
new file mode 100644 (file)
index 0000000..359bead
--- /dev/null
@@ -0,0 +1,9 @@
+implementation module eval
+
+import StdEnv
+import test
+
+eval :: DSL -> Int
+eval (Lit i) = i
+eval (Var def) = let (i In d) = def (Lit i) in eval d
+eval (a +. b) = eval a + eval b
diff --git a/deep-var/pprint b/deep-var/pprint
new file mode 100755 (executable)
index 0000000..9efca5e
Binary files /dev/null and b/deep-var/pprint differ
diff --git a/deep-var/pprint.dcl b/deep-var/pprint.dcl
new file mode 100644 (file)
index 0000000..b3da9ff
--- /dev/null
@@ -0,0 +1,5 @@
+definition module pprint
+
+from test import :: DSL
+
+pprint :: DSL -> String
diff --git a/deep-var/pprint.icl b/deep-var/pprint.icl
new file mode 100644 (file)
index 0000000..33feaff
--- /dev/null
@@ -0,0 +1,26 @@
+implementation module pprint
+
+import Control.Applicative
+import Control.Monad => qualified join
+import Control.Monad.Reader
+import Control.Monad.Identity
+import Data.Func
+import Data.Functor
+import Data.List
+import Text
+import StdEnv
+
+import test
+
+:: DSL | PPrintVar String
+
+pprint :: DSL -> String
+pprint d = concat $ runReader (print d) ["x" +++ toString i\\i<-[0..]]
+
+print :: DSL -> Reader [String] [String]
+print (Lit i) = pure $ pure $ toString i
+print (PPrintVar s) = pure $ pure s
+print (Var def) = asks hd >>= \v->
+       let (i In d) = def (PPrintVar v)
+       in local tl $ ((++) ["var ",v,"=",toString i," in\n"]) <$> print d
+print (a +. b) = liftA2 (\as bs->as++["+":bs]) (print a) (print b)
diff --git a/deep-var/test.dcl b/deep-var/test.dcl
new file mode 100644 (file)
index 0000000..69caac4
--- /dev/null
@@ -0,0 +1,8 @@
+definition module test
+
+:: In a b = In infix 0 a b
+:: DSL
+       = Lit Int
+       | Var (DSL -> In Int DSL)
+       | (+.) infixl 6 DSL DSL
+       | ..
diff --git a/deep-var/test.icl b/deep-var/test.icl
new file mode 100644 (file)
index 0000000..8763ffa
--- /dev/null
@@ -0,0 +1,7 @@
+implementation module test
+
+import pprint, eval
+
+Start = (pprint expr, eval expr)
+where
+       expr = Var \x=4 In Lit 38 +. x
diff --git a/lat/test.icl b/lat/test.icl
new file mode 100644 (file)
index 0000000..1db4bdf
--- /dev/null
@@ -0,0 +1,7 @@
+module test
+
+import StdEnv
+
+f = (+) 4
+
+Start = f 6
diff --git a/overloading_tc/test.icl b/overloading_tc/test.icl
new file mode 100644 (file)
index 0000000..cf14d22
--- /dev/null
@@ -0,0 +1,20 @@
+module test
+
+import StdEnv
+
+class type a | c1 a & TC a
+
+class c1 a :: a -> Int
+class rtrn v :: v ()
+class arith v
+where
+       (+.) :: (v a) (v a) -> (v a) | type, + a
+
+//:: WMT = E.e v: WMT (v e) & type e & iTask e & rtrn v & arith v
+:: WMT = E.e v: WMT (v e) & type e & rtrn v & arith v
+
+Start :: [WMT]
+Start =
+       [undef
+       ,undef
+       ]
diff --git a/runtime-generic/test.icl b/runtime-generic/test.icl
new file mode 100644 (file)
index 0000000..248ef5d
--- /dev/null
@@ -0,0 +1,13 @@
+module test
+
+import StdEnv => qualified return
+import iTasks
+
+derive class iTask UInt8
+
+Start w = startEngine t w
+
+:: UInt8 =: UInt8 Int
+
+t :: Task UInt8
+t = enterInformation () []
diff --git a/strictlet/test.icl b/strictlet/test.icl
new file mode 100644 (file)
index 0000000..524e34e
--- /dev/null
@@ -0,0 +1,6 @@
+module test
+
+//Start = let! a = 4 in a
+Start
+#! a = 4
+= a