Commit b0ffc354 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

*** empty log message ***

parent 27b466f4
module GenericDatabase module GenericDatabase
import Gerda, StdEnv import Gerda, StdEnv, GenEq//, MyDebug
:: R = {naam :: [Char], leeftijd :: Real, rec :: Maybe R} :: R = {naam :: [Char], leeftijd :: Real, rec :: Maybe R}
:: A = C R :: A = C R
...@@ -11,59 +11,40 @@ import Gerda, StdEnv ...@@ -11,59 +11,40 @@ import Gerda, StdEnv
:: GRose m a = GRose a (m (GRose m a)) :: GRose m a = GRose a (m (GRose m a))
:: Test` = Constr` Int :: Test` = Constr` Int
Start world :: Test = E. a: {value :: a, write :: a *Gerda -> *Gerda, read :: *Gerda -> *(a, *Gerda), equal :: a a -> Bool}
# (g, world) = openGerda "Clean Data Structures" world
// x = 42 test :: a -> Test | gerda{|*|}, gEq{|*|} a
// x = [[1]] test x = {value = x, write = \x g -> writeGerda "test" x g, read = \g -> case readGerda "test" g of (Just x, g) -> (x, g), equal = (===)}
// x = (1, 3.1415927, 'a', [C2, C1, C3])
// x = [3, 5, 7] tests = flatten (repeatn 10 [
// x = [C3, C1, C2, C1, C3, C2] // test {gerdaKey = 1, gerdaValue = 2},
// x = [[[[[[[1]]]]]]] test 42,
// x = ["test"] test C1,
// x = ['aapnoot'] test (Constr` 42),
// x = [['aap'], ['noot']] test [1, 3, 5, 7],
// x = Bin (Tip 'a') 42 (Tip 'b') test (1, 3.1415927, 'a', [C3, C1, C2, C1, C3, C2]),
// x = Rose 1 [Rose 2 [], Rose 3 []] test [[[[[[[1]]]]]]],
// x = [[C1, C2], [C3, C2, C1]] test "test",
// r1 = {naam = ['aap'], leeftijd = 13.5, rec = Nothing} test ("a" +++ {'b' \\ _ <- [1..1000]}),
// r2 = {naam = ['aap'], leeftijd = 13.5, rec = Just r1} test [['aap'], ['noot']],
// x = array {r1, r2, r2, r1} test (Bin (Tip 'a') 42 (Tip 'b')),
// x = ["Hello", "world"] test (Rose 1 [Rose 2 [], Rose 3 []]),
// x = Rose 1 [Rose 2 [], Rose 3 []] test p1,
// x = "a" +++ {'b' \\ _ <- [1..1000]} test p2,
// x = GRose (1, 'a', 0.5, "bud") [GRose (2, 'b', 0.75, "another bud") [], GRose (3, 'c', 0.875, "yet another bud") []] test r2,
// x = [1..10000] test (strictArray {2, 3, 5, 7, 11, 13, 17, 19}),
// x = array {strictArray {1, 2, 3}, strictArray {1 .. 100}} test (array {r1, r2, r2, r1}),
// x = Constr` 42 test (GRose (1, 'a', 0.5, "bud") [GRose (2, 'b', 0.75, "another bud") [], GRose (3, 'c', 0.875, "yet another bud") []]),
x = PAIR Nothing Nothing test {gerdaUnique = 21}])
g = writeGerda "test`.1" x g
// g = writeGerda "test2" x2 g
(y, g) = readGerda "test`.1" g
// (y2, g) = readGerda "test2" g
/* = case y `typeOf` x of
Just x`
# g = writeGerda "test2" x` g
(z, g) = readGerda "test" g
-> (z `typeOf` x, closeGerda g world)*/
= (y `typeOf` x, closeGerda g world)
// x = gerdaObject 42
// g = writeGerda "test" x g
// (y, g) = readGerda "test" g
// f = case y of Just {gerdaWrite} -> gerdaWrite; _ -> const id
// h = case y of Just {gerdaRead} -> gerdaRead; _ -> (\g -> (undef, g))
// g = f 123 g
// (w, g) = h g
// (z, g) = readGerda "test" g
// = (y `typeOf` x, Just w `typeOf` x.gerdaValue, z `typeOf` x, closeGerda g world)
where where
(`typeOf`) :: !(Maybe (EITHER Int Int)) (PAIR (Maybe Int) (Maybe Int)) -> Maybe (EITHER Int Int) r1 = {naam = ['noot'], leeftijd = 41.2, rec = Nothing}
(`typeOf`) x _ = x r2 = {naam = ['aap'], leeftijd = 13.5, rec = Just r1}
x :: Phantom [Int] p1 :: Phantom Char
x = Opera p1 = Opera
x2 :: Phantom Char p2 :: Phantom [Int]
x2 = Opera p2 = Opera
array :: !{a} -> {a} array :: !{a} -> {a}
array x = x array x = x
...@@ -71,7 +52,36 @@ where ...@@ -71,7 +52,36 @@ where
strictArray :: !{!a} -> {!a} strictArray :: !{!a} -> {!a}
strictArray x = x strictArray x = x
derive gerda Tree, Rose, R, N, (,), (,,), (,,,), GRose, Test`, Phantom runTests [{value, write, read, equal}:ts] g
# g = write value g
(v, g) = read g
| not (equal v value) = abort "TEST FAILED" //<<- (value, v)
= runTests ts g
runTests _ g = g
Start world
# (g, world) = openGerda "Clean Data Structures" world
g = runTests tests g
x = gerdaObject (42, 'a', 3.14, [1..10])
g = writeGerda "test2" x g
(y, g) = readGerda "test2" g
w = case y of Just {gerdaWrite} -> gerdaWrite; _ -> const id
r = case y of Just {gerdaRead} -> gerdaRead; _ -> (\g -> (abort "NO readGerda", g))
g = w (123, 'b', 2.41, []) g
(u, g) = r g
g = w (789, 'c', 1.61, []) g
(z, g) = r g
(v, g) = readGerda "test2" g
= (mapMaybe (\{gerdaObject} -> gerdaObject) y `typeOf` x.gerdaObject, u, z, mapMaybe (\{gerdaObject} -> gerdaObject) v `typeOf` x.gerdaObject, closeGerda g world)
// = closeGerda g world
where
(`typeOf`) :: !(Maybe a) a -> Maybe a
(`typeOf`) x _ = x
derive gerda (,), (,,), (,,,), Tree, Rose, R, N, GRose, Test`, Phantom
derive gEq GerdaPrimary, GerdaUnique, Binary252, Maybe, Tree, Rose, R, N, Test`, Phantom
gEq{|GRose|} eq_m eq_a (GRose x xs) (GRose y ys) = eq_a x y && eq_m (gEq{|(*->*)->*->*|} eq_m eq_a) xs ys
:: Phantom a = Opera :: Phantom a = Opera
......
...@@ -7,8 +7,8 @@ Global ...@@ -7,8 +7,8 @@ Global
CheckStacks: False CheckStacks: False
CheckIndexes: True CheckIndexes: True
Application Application
HeapSize: 4194304 HeapSize: 8388608
StackSize: 1048576 StackSize: 2097152
ExtraMemory: 81920 ExtraMemory: 81920
IntialHeapSize: 204800 IntialHeapSize: 204800
HeapSizeMultiplier: 4096 HeapSizeMultiplier: 4096
...@@ -18,7 +18,7 @@ Global ...@@ -18,7 +18,7 @@ Global
MarkingCollector: False MarkingCollector: False
StandardRuntimeEnv: True StandardRuntimeEnv: True
Profile Profile
Memory: True Memory: False
MemoryMinimumHeapSize: 0 MemoryMinimumHeapSize: 0
Time: True Time: True
Stack: False Stack: False
...@@ -38,6 +38,7 @@ Global ...@@ -38,6 +38,7 @@ Global
Paths Paths
Path: {Project} Path: {Project}
Path: {Application}\Libraries\StdLib Path: {Application}\Libraries\StdLib
Path: {Application}\Libraries\Generics
Path: {Application}\Libraries\WrapDebug Path: {Application}\Libraries\WrapDebug
Precompile: Precompile:
Postlink: Postlink:
...@@ -61,13 +62,13 @@ MainModule ...@@ -61,13 +62,13 @@ MainModule
X: 10 X: 10
Y: 10 Y: 10
SizeX: 622 SizeX: 622
SizeY: 490 SizeY: 511
IclOpen: True IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
OtherModules OtherModules
Module Module
Name: Gerda Name: GenEq
Dir: {Project} Dir: {Application}\Libraries\Generics
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
NeverTimeProfile: False NeverTimeProfile: False
...@@ -76,27 +77,15 @@ OtherModules ...@@ -76,27 +77,15 @@ OtherModules
ListAttributes: True ListAttributes: True
Warnings: True Warnings: True
Verbose: True Verbose: True
ReadableABC: True ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl DclOpen: False
WindowPosition IclOpen: False
X: 88
Y: 44
SizeX: 751
SizeY: 477
DclOpen: True
Icl
WindowPosition
X: 26
Y: 41
SizeX: 800
SizeY: 494
IclOpen: True
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdGeneric Name: odbccp
Dir: {Application}\Libraries\StdEnv Dir: {Project}
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
NeverTimeProfile: False NeverTimeProfile: False
...@@ -108,6 +97,12 @@ OtherModules ...@@ -108,6 +97,12 @@ OtherModules
ReadableABC: False ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl
WindowPosition
X: 224
Y: 74
SizeX: 800
SizeY: 632
DclOpen: False DclOpen: False
Icl Icl
WindowPosition WindowPosition
...@@ -117,9 +112,11 @@ OtherModules ...@@ -117,9 +112,11 @@ OtherModules
SizeY: 640 SizeY: 640
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
NeededLibraries
Library: odbccp_library
Module Module
Name: StdInt Name: odbc
Dir: {Application}\Libraries\StdEnv Dir: {Project}
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
NeverTimeProfile: False NeverTimeProfile: False
...@@ -131,11 +128,25 @@ OtherModules ...@@ -131,11 +128,25 @@ OtherModules
ReadableABC: False ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl
WindowPosition
X: 211
Y: 44
SizeX: 800
SizeY: 646
DclOpen: False DclOpen: False
Icl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
NeededLibraries
Library: odbc_library
Module Module
Name: StdOverloaded Name: StdDebug
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -158,7 +169,7 @@ OtherModules ...@@ -158,7 +169,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdMisc Name: StdCharList
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -175,7 +186,7 @@ OtherModules ...@@ -175,7 +186,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdClass Name: StdTuple
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -198,25 +209,8 @@ OtherModules ...@@ -198,25 +209,8 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdBool Name: StdOrdList
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdMaybe
Dir: {Application}\Libraries\StdLib
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
NeverTimeProfile: False NeverTimeProfile: False
...@@ -238,7 +232,7 @@ OtherModules ...@@ -238,7 +232,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdFunc Name: _SystemEnum
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -251,17 +245,11 @@ OtherModules ...@@ -251,17 +245,11 @@ OtherModules
ReadableABC: False ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False DclOpen: False
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdEnv Name: StdEnum
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -278,7 +266,7 @@ OtherModules ...@@ -278,7 +266,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdReal Name: StdList
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -291,11 +279,17 @@ OtherModules ...@@ -291,11 +279,17 @@ OtherModules
ReadableABC: False ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False DclOpen: False
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdChar Name: StdFile
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -312,7 +306,7 @@ OtherModules ...@@ -312,7 +306,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdArray Name: StdString
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -364,7 +358,7 @@ OtherModules ...@@ -364,7 +358,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdString Name: StdArray
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -387,7 +381,7 @@ OtherModules ...@@ -387,7 +381,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdFile Name: StdChar
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -404,7 +398,7 @@ OtherModules ...@@ -404,7 +398,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdList Name: StdReal
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -421,7 +415,7 @@ OtherModules ...@@ -421,7 +415,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdEnum Name: StdEnv
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -438,7 +432,7 @@ OtherModules ...@@ -438,7 +432,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: _SystemEnum Name: StdFunc
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -451,12 +445,18 @@ OtherModules ...@@ -451,12 +445,18 @@ OtherModules
ReadableABC: False ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False DclOpen: False
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdOrdList Name: StdMaybe
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdLib
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
NeverTimeProfile: False NeverTimeProfile: False
...@@ -478,7 +478,7 @@ OtherModules ...@@ -478,7 +478,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdTuple Name: StdBool
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -495,7 +495,7 @@ OtherModules ...@@ -495,7 +495,7 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdCharList Name: StdClass
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -508,11 +508,17 @@ OtherModules ...@@ -508,11 +508,17 @@ OtherModules
ReadableABC: False ReadableABC: False
ReuseUniqueNodes: True ReuseUniqueNodes: True
Fusion: False Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False DclOpen: False
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: StdDebug Name: StdMisc
Dir: {Application}\Libraries\StdEnv Dir: {Application}\Libraries\StdEnv
Compiler Compiler
NeverMemoryProfile: False NeverMemoryProfile: False
...@@ -529,8 +535,8 @@ OtherModules ...@@ -529,8 +535,8 @@ OtherModules
IclOpen: False IclOpen: False
LastModified: No 0 0 0 0 0 0 LastModified: No 0 0 0 0 0 0
Module Module
Name: odbc Name: StdOverloaded
Dir: {Project} Dir: {Application}\Libraries\StdEnv
Compiler Compiler