diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:57:54 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:57:54 +0200 |
| commit | 58ae983e0dc2e3a9fe7a0fd29c3342289812d3f8 (patch) | |
| tree | 113fb4fe90d10642155af90b30d51bb320e799d1 | |
| parent | 4002b8988c799a904ef1f359d4267ef4ad80cba3 (diff) | |
Add -O2 to ghc-options
| -rw-r--r-- | examples/fibo.milch | 7 | ||||
| -rw-r--r-- | examples/test.milch | 10 | ||||
| -rw-r--r-- | lang.cabal | 6 | ||||
| -rw-r--r-- | package.yaml | 1 | ||||
| -rw-r--r-- | stdlib/common.milch | 8 | ||||
| -rw-r--r-- | todo.md | 1 |
6 files changed, 12 insertions, 21 deletions
diff --git a/examples/fibo.milch b/examples/fibo.milch new file mode 100644 index 0000000..26c74a1 --- /dev/null +++ b/examples/fibo.milch @@ -0,0 +1,7 @@ +(let! fibo (\[n] + (match n + 0 0 + 1 1 + _ (+ (fibo (- n 1)) (fibo (- n 2)))))) + +(fibo 30) diff --git a/examples/test.milch b/examples/test.milch index fd8c379..84193eb 100644 --- a/examples/test.milch +++ b/examples/test.milch @@ -52,16 +52,6 @@ (filter is-even [0 1 2 3 4 5]) -(let! fibo (\[n] - (let! lazy fibo-1 (fibo (- n 1))) - (let! lazy fibo-2 (fibo (- n 2))) - (match n - 0 0 - 1 1 - _ (+ fibo-1 fibo-2)))) - -(fibo 10) - (let! reverse_ (\[v a] (let! lazy x (head v)) (let! lazy xs (tail v)) @@ -34,7 +34,7 @@ library Paths_lang hs-source-dirs: src - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -O2 build-depends: HUnit ==1.6.2.0 , base >=4.7 && <5 @@ -51,7 +51,7 @@ executable lang-exe Paths_lang hs-source-dirs: app - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: HUnit ==1.6.2.0 , base >=4.7 && <5 @@ -71,7 +71,7 @@ test-suite lang-test Paths_lang hs-source-dirs: test - ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: HUnit ==1.6.2.0 , base >=4.7 && <5 diff --git a/package.yaml b/package.yaml index 1736775..ec09966 100644 --- a/package.yaml +++ b/package.yaml @@ -38,6 +38,7 @@ ghc-options: - -Wmissing-home-modules - -Wpartial-fields - -Wredundant-constraints +- -O2 library: source-dirs: src diff --git a/stdlib/common.milch b/stdlib/common.milch index 4d5b132..b04cf37 100644 --- a/stdlib/common.milch +++ b/stdlib/common.milch @@ -46,14 +46,6 @@ false (filter pred (tail lst)))))) -(let! fibo (\[n] - (let! lazy fibo-1 (fibo (- n 1))) - (let! lazy fibo-2 (fibo (- n 2))) - (match n - 0 0 - 1 1 - _ (+ fibo-1 fibo-2)))) - (let! reverse_ (\[v a] (let! lazy x (head v)) (let! lazy xs (tail v)) @@ -3,6 +3,7 @@ In order of priority - Implement records and unions +- Memoize pure functions automatically - Write function let expressions properly using lookups - Write tests! - Add effects system (see `examples/effects-concept.milch`) |
