diff --git a/.gitignore b/.gitignore index ef844fb..1baf2f4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,45 @@ log.txt *.cabal .vscode stack.yaml.lock + +out +result +dist +dist-* +cabal-dev +*.o +*.hi +*.chi +*.chs.h +*.dyn_o +*.dyn_hi +.hpc +.hsenv +.cabal-sandbox/ +cabal.sandbox.config +*.prof +*.aux +*.hp +*.eventlog +.stack-work/ +cabal.project.local +cabal.project.local~ +.HTF/ +.ghc.environment.* +dist-newstyle +.stack-work +stack.yaml.lock +*.cabal + +.ghci +.ghcid + +.idea/ +*.iml + +*.diff +*.patch +tags + +.vscode/ +.nvimrc diff --git a/app/MeteorCounter/package.yaml b/app/MeteorCounter/package.yaml new file mode 100644 index 0000000..554aab1 --- /dev/null +++ b/app/MeteorCounter/package.yaml @@ -0,0 +1,147 @@ +name: MeteorCounter +version: 1.0.0.0 +github: "graninas/Hydra" +license: BSD3 +author: "Alexander Granin" +maintainer: "graninas@gmail.com" +copyright: "Granin A.S. 2020" + +description: + MeteorCounter app + +default-extensions: +- NoImplicitPrelude +- GADTs +- RankNTypes +- DeriveFunctor +- DeriveGeneric +- OverloadedStrings +- LambdaCase +- MultiParamTypeClasses +- ExplicitNamespaces +- TypeApplications +- ScopedTypeVariables +- TypeOperators +- TypeFamilies +- DataKinds +- FlexibleContexts +- FlexibleInstances +- PatternSynonyms +- PolyKinds +- DefaultSignatures +- ConstraintKinds +- NamedFieldPuns +- TupleSections +- ViewPatterns +- MultiWayIf +- RecordWildCards + +dependencies: +- base >= 4.7 && < 5 +- bytestring +- time-units +- network +- aeson +- aeson-pretty +- cereal +- mtl +- cryptonite +- base16-bytestring +- base58-bytestring +- base64-bytestring +- arithmoi +- directory +- filepath +- process +- extra +- time +- clock +- vector +- scientific +- containers +- random +- free +- iproute +- memory +- transformers +- template-haskell +- async +- text +- haskeline +- cryptohash-sha256 +- bytestring-conversion +- newtype-generics +- lens +- universum +- fmt +- stm +- hslogger +- lens-aeson +- th-abstraction +- MonadRandom +- entropy +- validation +- silently +- uuid +- resourcet +- triplesec +- yaml +- newtype-generics +- regex-posix +- safe-exceptions +- unliftio +- unliftio-core +- rocksdb-haskell +- hedis +- beam-core +- beam-postgres +- beam-sqlite +- beam-migrate +- sqlite-simple +- resource-pool +- servant +- servant-server +- servant-client +- servant-swagger +- servant-docs +- wai +- warp +- http-client +- http-client-tls +- data-default +- generic-lens +- Hydra + +library: + source-dirs: + - src + ghc-options: + - -Wall + - -Wcompat + - -Widentities + - -fhide-source-paths + +executables: + MeteorCounter: + main: Main.hs + source-dirs: src/ + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -Wall + # - -O2 + + +# +# tests: +# functional-tests: +# main: Spec.hs +# source-dirs: +# - test/spec +# ghc-options: +# - -threaded +# - -rtsopts +# - -with-rtsopts=-N +# dependencies: +# - Hydra diff --git a/app/MeteorCounter/Church.hs b/app/MeteorCounter/src/Church.hs similarity index 100% rename from app/MeteorCounter/Church.hs rename to app/MeteorCounter/src/Church.hs diff --git a/app/MeteorCounter/FTL.hs b/app/MeteorCounter/src/FTL.hs similarity index 100% rename from app/MeteorCounter/FTL.hs rename to app/MeteorCounter/src/FTL.hs diff --git a/app/MeteorCounter/FTLTypes.hs b/app/MeteorCounter/src/FTLTypes.hs similarity index 100% rename from app/MeteorCounter/FTLTypes.hs rename to app/MeteorCounter/src/FTLTypes.hs diff --git a/app/MeteorCounter/Free.hs b/app/MeteorCounter/src/Free.hs similarity index 100% rename from app/MeteorCounter/Free.hs rename to app/MeteorCounter/src/Free.hs diff --git a/app/MeteorCounter/Main.hs b/app/MeteorCounter/src/Main.hs similarity index 100% rename from app/MeteorCounter/Main.hs rename to app/MeteorCounter/src/Main.hs diff --git a/app/MeteorCounter/Types.hs b/app/MeteorCounter/src/Types.hs similarity index 100% rename from app/MeteorCounter/Types.hs rename to app/MeteorCounter/src/Types.hs diff --git a/app/PerfTestApp/package.yaml b/app/PerfTestApp/package.yaml new file mode 100644 index 0000000..a9f6503 --- /dev/null +++ b/app/PerfTestApp/package.yaml @@ -0,0 +1,146 @@ +name: PerfTestApp +version: 1.0.0.0 +github: "graninas/Hydra" +license: BSD3 +author: "Alexander Granin" +maintainer: "graninas@gmail.com" +copyright: "Granin A.S. 2020" + +description: + PerfTestApp + +default-extensions: +- NoImplicitPrelude +- GADTs +- RankNTypes +- DeriveFunctor +- DeriveGeneric +- OverloadedStrings +- LambdaCase +- MultiParamTypeClasses +- ExplicitNamespaces +- TypeApplications +- ScopedTypeVariables +- TypeOperators +- TypeFamilies +- DataKinds +- FlexibleContexts +- FlexibleInstances +- PatternSynonyms +- PolyKinds +- DefaultSignatures +- ConstraintKinds +- NamedFieldPuns +- TupleSections +- ViewPatterns +- MultiWayIf +- RecordWildCards + +dependencies: +- base >= 4.7 && < 5 +- bytestring +- time-units +- network +- aeson +- aeson-pretty +- cereal +- mtl +- cryptonite +- base16-bytestring +- base58-bytestring +- base64-bytestring +- arithmoi +- directory +- filepath +- process +- extra +- time +- clock +- vector +- scientific +- containers +- random +- free +- iproute +- memory +- transformers +- template-haskell +- async +- text +- haskeline +- cryptohash-sha256 +- bytestring-conversion +- newtype-generics +- lens +- universum +- fmt +- stm +- hslogger +- lens-aeson +- th-abstraction +- MonadRandom +- entropy +- validation +- silently +- uuid +- resourcet +- triplesec +- yaml +- newtype-generics +- regex-posix +- safe-exceptions +- unliftio +- unliftio-core +- rocksdb-haskell +- hedis +- beam-core +- beam-postgres +- beam-sqlite +- beam-migrate +- sqlite-simple +- resource-pool +- servant +- servant-server +- servant-client +- servant-swagger +- servant-docs +- wai +- warp +- http-client +- http-client-tls +- data-default +- generic-lens +- Hydra + +library: + source-dirs: + - src + ghc-options: + - -Wall + - -Wcompat + - -Widentities + - -fhide-source-paths + +executables: + PerfTestApp: + main: Main.hs + source-dirs: src/ + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -Wall + # - -O2 + +# +# tests: +# functional-tests: +# main: Spec.hs +# source-dirs: +# - test/spec +# ghc-options: +# - -threaded +# - -rtsopts +# - -with-rtsopts=-N +# dependencies: +# - Hydra diff --git a/app/PerfTestApp/Main.hs b/app/PerfTestApp/src/Main.hs similarity index 100% rename from app/PerfTestApp/Main.hs rename to app/PerfTestApp/src/Main.hs diff --git a/app/PerfTestApp/PerfChurch.hs b/app/PerfTestApp/src/PerfChurch.hs similarity index 100% rename from app/PerfTestApp/PerfChurch.hs rename to app/PerfTestApp/src/PerfChurch.hs diff --git a/app/PerfTestApp/PerfFTL.hs b/app/PerfTestApp/src/PerfFTL.hs similarity index 100% rename from app/PerfTestApp/PerfFTL.hs rename to app/PerfTestApp/src/PerfFTL.hs diff --git a/app/PerfTestApp/PerfFree.hs b/app/PerfTestApp/src/PerfFree.hs similarity index 100% rename from app/PerfTestApp/PerfFree.hs rename to app/PerfTestApp/src/PerfFree.hs diff --git a/app/PerfTestApp/PerfTypes.hs b/app/PerfTestApp/src/PerfTypes.hs similarity index 100% rename from app/PerfTestApp/PerfTypes.hs rename to app/PerfTestApp/src/PerfTypes.hs diff --git a/app/PerfTestApp2/package.yaml b/app/PerfTestApp2/package.yaml new file mode 100644 index 0000000..e21c0ec --- /dev/null +++ b/app/PerfTestApp2/package.yaml @@ -0,0 +1,146 @@ +name: PerfTestApp2 +version: 1.0.0.0 +github: "graninas/Hydra" +license: BSD3 +author: "Alexander Granin" +maintainer: "graninas@gmail.com" +copyright: "Granin A.S. 2020" + +description: + PerfTestApp2 + +default-extensions: +- NoImplicitPrelude +- GADTs +- RankNTypes +- DeriveFunctor +- DeriveGeneric +- OverloadedStrings +- LambdaCase +- MultiParamTypeClasses +- ExplicitNamespaces +- TypeApplications +- ScopedTypeVariables +- TypeOperators +- TypeFamilies +- DataKinds +- FlexibleContexts +- FlexibleInstances +- PatternSynonyms +- PolyKinds +- DefaultSignatures +- ConstraintKinds +- NamedFieldPuns +- TupleSections +- ViewPatterns +- MultiWayIf +- RecordWildCards + +dependencies: +- base >= 4.7 && < 5 +- bytestring +- time-units +- network +- aeson +- aeson-pretty +- cereal +- mtl +- cryptonite +- base16-bytestring +- base58-bytestring +- base64-bytestring +- arithmoi +- directory +- filepath +- process +- extra +- time +- clock +- vector +- scientific +- containers +- random +- free +- iproute +- memory +- transformers +- template-haskell +- async +- text +- haskeline +- cryptohash-sha256 +- bytestring-conversion +- newtype-generics +- lens +- universum +- fmt +- stm +- hslogger +- lens-aeson +- th-abstraction +- MonadRandom +- entropy +- validation +- silently +- uuid +- resourcet +- triplesec +- yaml +- newtype-generics +- regex-posix +- safe-exceptions +- unliftio +- unliftio-core +- rocksdb-haskell +- hedis +- beam-core +- beam-postgres +- beam-sqlite +- beam-migrate +- sqlite-simple +- resource-pool +- servant +- servant-server +- servant-client +- servant-swagger +- servant-docs +- wai +- warp +- http-client +- http-client-tls +- data-default +- generic-lens +- Hydra + +library: + source-dirs: + - src + ghc-options: + - -Wall + - -Wcompat + - -Widentities + - -fhide-source-paths + +executables: + PerfTestApp2: + main: Main.hs + source-dirs: src/ + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -Wall + # - -O2 + +# +# tests: +# functional-tests: +# main: Spec.hs +# source-dirs: +# - test/spec +# ghc-options: +# - -threaded +# - -rtsopts +# - -with-rtsopts=-N +# dependencies: +# - Hydra diff --git a/app/PerfTestApp2/Church.hs b/app/PerfTestApp2/src/Church.hs similarity index 100% rename from app/PerfTestApp2/Church.hs rename to app/PerfTestApp2/src/Church.hs diff --git a/app/PerfTestApp2/FTL.hs b/app/PerfTestApp2/src/FTL.hs similarity index 100% rename from app/PerfTestApp2/FTL.hs rename to app/PerfTestApp2/src/FTL.hs diff --git a/app/PerfTestApp2/Free.hs b/app/PerfTestApp2/src/Free.hs similarity index 100% rename from app/PerfTestApp2/Free.hs rename to app/PerfTestApp2/src/Free.hs diff --git a/app/PerfTestApp2/IO.hs b/app/PerfTestApp2/src/IO.hs similarity index 100% rename from app/PerfTestApp2/IO.hs rename to app/PerfTestApp2/src/IO.hs diff --git a/app/PerfTestApp2/Main.hs b/app/PerfTestApp2/src/Main.hs similarity index 100% rename from app/PerfTestApp2/Main.hs rename to app/PerfTestApp2/src/Main.hs diff --git a/package.yaml b/app/astro/package.yaml similarity index 57% rename from package.yaml rename to app/astro/package.yaml index 1a5ebbd..aca7484 100644 --- a/package.yaml +++ b/app/astro/package.yaml @@ -1,14 +1,13 @@ -name: Hydra +name: astro version: 1.0.0.0 github: "graninas/Hydra" license: BSD3 author: "Alexander Granin" maintainer: "graninas@gmail.com" -copyright: "Granin A.S. 2019" +copyright: "Granin A.S. 2020" description: - Hydra is the project that allows to build multithreaded concurrent applications. - Hydra is initially based on the Hydra.Framework. + Astro web server and client for astronomers default-extensions: - NoImplicitPrelude @@ -115,83 +114,37 @@ dependencies: - http-client-tls - data-default - generic-lens +- Hydra library: source-dirs: - - src + - src ghc-options: - -Wall + - -Wcompat + - -Widentities + - -fhide-source-paths executables: - perf-test-app: + astro: main: Main.hs - source-dirs: app/PerfTestApp - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - - -Wall - - -O2 - dependencies: - - Hydra - - perf-test-app2: - main: Main.hs - source-dirs: app/PerfTestApp2 - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - - -Wall - - -O2 - dependencies: - - Hydra - - meteor-counter-app: - main: Main.hs - source-dirs: app/MeteorCounter - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - - -Wall - - -O2 - dependencies: - - Hydra - - astro-app: - main: Main.hs - source-dirs: app/astro - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - - -Wall - - -O2 - dependencies: - - Hydra - - labyrinth: - main: Main.hs - source-dirs: app/labyrinth + source-dirs: src/ ghc-options: - -threaded - -rtsopts - -with-rtsopts=-N - -Wall # - -O2 - dependencies: - - Hydra - -tests: - functional-tests: - main: Spec.hs - source-dirs: - - test/spec - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - dependencies: - - Hydra +# +# tests: +# functional-tests: +# main: Spec.hs +# source-dirs: +# - test/spec +# ghc-options: +# - -threaded +# - -rtsopts +# - -with-rtsopts=-N +# dependencies: +# - Hydra diff --git a/app/astro/Astro/API.hs b/app/astro/src/Astro/API.hs similarity index 100% rename from app/astro/Astro/API.hs rename to app/astro/src/Astro/API.hs diff --git a/app/astro/Astro/API/Asteroid.hs b/app/astro/src/Astro/API/Asteroid.hs similarity index 100% rename from app/astro/Astro/API/Asteroid.hs rename to app/astro/src/Astro/API/Asteroid.hs diff --git a/app/astro/Astro/API/AstroObject.hs b/app/astro/src/Astro/API/AstroObject.hs similarity index 100% rename from app/astro/Astro/API/AstroObject.hs rename to app/astro/src/Astro/API/AstroObject.hs diff --git a/app/astro/Astro/API/Meteor.hs b/app/astro/src/Astro/API/Meteor.hs similarity index 100% rename from app/astro/Astro/API/Meteor.hs rename to app/astro/src/Astro/API/Meteor.hs diff --git a/app/astro/Astro/Catalogue.hs b/app/astro/src/Astro/Catalogue.hs similarity index 100% rename from app/astro/Astro/Catalogue.hs rename to app/astro/src/Astro/Catalogue.hs diff --git a/app/astro/Astro/Client/Common.hs b/app/astro/src/Astro/Client/Common.hs similarity index 100% rename from app/astro/Astro/Client/Common.hs rename to app/astro/src/Astro/Client/Common.hs diff --git a/app/astro/Astro/Client/FinalTagless.hs b/app/astro/src/Astro/Client/FinalTagless.hs similarity index 100% rename from app/astro/Astro/Client/FinalTagless.hs rename to app/astro/src/Astro/Client/FinalTagless.hs diff --git a/app/astro/Astro/Client/FinalTagless2.hs b/app/astro/src/Astro/Client/FinalTagless2.hs similarity index 100% rename from app/astro/Astro/Client/FinalTagless2.hs rename to app/astro/src/Astro/Client/FinalTagless2.hs diff --git a/app/astro/Astro/Client/FreeMonad.hs b/app/astro/src/Astro/Client/FreeMonad.hs similarity index 100% rename from app/astro/Astro/Client/FreeMonad.hs rename to app/astro/src/Astro/Client/FreeMonad.hs diff --git a/app/astro/Astro/Client/GADT.hs b/app/astro/src/Astro/Client/GADT.hs similarity index 100% rename from app/astro/Astro/Client/GADT.hs rename to app/astro/src/Astro/Client/GADT.hs diff --git a/app/astro/Astro/Client/ReaderT.hs b/app/astro/src/Astro/Client/ReaderT.hs similarity index 100% rename from app/astro/Astro/Client/ReaderT.hs rename to app/astro/src/Astro/Client/ReaderT.hs diff --git a/app/astro/Astro/Client/ServiceHandle.hs b/app/astro/src/Astro/Client/ServiceHandle.hs similarity index 100% rename from app/astro/Astro/Client/ServiceHandle.hs rename to app/astro/src/Astro/Client/ServiceHandle.hs diff --git a/app/astro/Astro/Config.hs b/app/astro/src/Astro/Config.hs similarity index 100% rename from app/astro/Astro/Config.hs rename to app/astro/src/Astro/Config.hs diff --git a/app/astro/Astro/Domain/Asteroid.hs b/app/astro/src/Astro/Domain/Asteroid.hs similarity index 100% rename from app/astro/Astro/Domain/Asteroid.hs rename to app/astro/src/Astro/Domain/Asteroid.hs diff --git a/app/astro/Astro/Domain/AstroObject.hs b/app/astro/src/Astro/Domain/AstroObject.hs similarity index 100% rename from app/astro/Astro/Domain/AstroObject.hs rename to app/astro/src/Astro/Domain/AstroObject.hs diff --git a/app/astro/Astro/Domain/Meteor.hs b/app/astro/src/Astro/Domain/Meteor.hs similarity index 100% rename from app/astro/Astro/Domain/Meteor.hs rename to app/astro/src/Astro/Domain/Meteor.hs diff --git a/app/astro/Astro/Domain/Types.hs b/app/astro/src/Astro/Domain/Types.hs similarity index 100% rename from app/astro/Astro/Domain/Types.hs rename to app/astro/src/Astro/Domain/Types.hs diff --git a/app/astro/Astro/KVDB/AstroDB.hs b/app/astro/src/Astro/KVDB/AstroDB.hs similarity index 100% rename from app/astro/Astro/KVDB/AstroDB.hs rename to app/astro/src/Astro/KVDB/AstroDB.hs diff --git a/app/astro/Astro/Lens.hs b/app/astro/src/Astro/Lens.hs similarity index 100% rename from app/astro/Astro/Lens.hs rename to app/astro/src/Astro/Lens.hs diff --git a/app/astro/Astro/Server.hs b/app/astro/src/Astro/Server.hs similarity index 100% rename from app/astro/Astro/Server.hs rename to app/astro/src/Astro/Server.hs diff --git a/app/astro/Astro/SqlDB/AstroDB.hs b/app/astro/src/Astro/SqlDB/AstroDB.hs similarity index 100% rename from app/astro/Astro/SqlDB/AstroDB.hs rename to app/astro/src/Astro/SqlDB/AstroDB.hs diff --git a/app/astro/Astro/Types.hs b/app/astro/src/Astro/Types.hs similarity index 100% rename from app/astro/Astro/Types.hs rename to app/astro/src/Astro/Types.hs diff --git a/app/astro/Hydra - astro.postman_collection.json b/app/astro/src/Hydra - astro.postman_collection.json similarity index 100% rename from app/astro/Hydra - astro.postman_collection.json rename to app/astro/src/Hydra - astro.postman_collection.json diff --git a/app/astro/Main.hs b/app/astro/src/Main.hs similarity index 100% rename from app/astro/Main.hs rename to app/astro/src/Main.hs diff --git a/app/astro/astro_template.db b/app/astro/src/astro_template.db similarity index 100% rename from app/astro/astro_template.db rename to app/astro/src/astro_template.db diff --git a/app/labyrinth/package.yaml b/app/labyrinth/package.yaml new file mode 100644 index 0000000..51c4cf9 --- /dev/null +++ b/app/labyrinth/package.yaml @@ -0,0 +1,146 @@ +name: labyrinth +version: 1.0.0.0 +github: "graninas/Hydra" +license: BSD3 +author: "Alexander Granin" +maintainer: "graninas@gmail.com" +copyright: "Granin A.S. 2020" + +description: + Labyrinth game (aka Terra Incognita) + +default-extensions: +- NoImplicitPrelude +- GADTs +- RankNTypes +- DeriveFunctor +- DeriveGeneric +- OverloadedStrings +- LambdaCase +- MultiParamTypeClasses +- ExplicitNamespaces +- TypeApplications +- ScopedTypeVariables +- TypeOperators +- TypeFamilies +- DataKinds +- FlexibleContexts +- FlexibleInstances +- PatternSynonyms +- PolyKinds +- DefaultSignatures +- ConstraintKinds +- NamedFieldPuns +- TupleSections +- ViewPatterns +- MultiWayIf +- RecordWildCards + +dependencies: +- base >= 4.7 && < 5 +- bytestring +- time-units +- network +- aeson +- aeson-pretty +- cereal +- mtl +- cryptonite +- base16-bytestring +- base58-bytestring +- base64-bytestring +- arithmoi +- directory +- filepath +- process +- extra +- time +- clock +- vector +- scientific +- containers +- random +- free +- iproute +- memory +- transformers +- template-haskell +- async +- text +- haskeline +- cryptohash-sha256 +- bytestring-conversion +- newtype-generics +- lens +- universum +- fmt +- stm +- hslogger +- lens-aeson +- th-abstraction +- MonadRandom +- entropy +- validation +- silently +- uuid +- resourcet +- triplesec +- yaml +- newtype-generics +- regex-posix +- safe-exceptions +- unliftio +- unliftio-core +- rocksdb-haskell +- hedis +- beam-core +- beam-postgres +- beam-sqlite +- beam-migrate +- sqlite-simple +- resource-pool +- servant +- servant-server +- servant-client +- servant-swagger +- servant-docs +- wai +- warp +- http-client +- http-client-tls +- data-default +- generic-lens +- Hydra + +library: + source-dirs: + - src + ghc-options: + - -Wall + - -Wcompat + - -Widentities + - -fhide-source-paths + +executables: + labyrinth: + main: Main.hs + source-dirs: src/ + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -Wall + # - -O2 + +# +# tests: +# functional-tests: +# main: Spec.hs +# source-dirs: +# - test/spec +# ghc-options: +# - -threaded +# - -rtsopts +# - -with-rtsopts=-N +# dependencies: +# - Hydra diff --git a/app/labyrinth/Labyrinth.todo b/app/labyrinth/src/Labyrinth.todo similarity index 100% rename from app/labyrinth/Labyrinth.todo rename to app/labyrinth/src/Labyrinth.todo diff --git a/app/labyrinth/Labyrinth/App.hs b/app/labyrinth/src/Labyrinth/App.hs similarity index 100% rename from app/labyrinth/Labyrinth/App.hs rename to app/labyrinth/src/Labyrinth/App.hs diff --git a/app/labyrinth/Labyrinth/Domain.hs b/app/labyrinth/src/Labyrinth/Domain.hs similarity index 100% rename from app/labyrinth/Labyrinth/Domain.hs rename to app/labyrinth/src/Labyrinth/Domain.hs diff --git a/app/labyrinth/Labyrinth/Gen.hs b/app/labyrinth/src/Labyrinth/Gen.hs similarity index 100% rename from app/labyrinth/Labyrinth/Gen.hs rename to app/labyrinth/src/Labyrinth/Gen.hs diff --git a/app/labyrinth/Labyrinth/Lens.hs b/app/labyrinth/src/Labyrinth/Lens.hs similarity index 100% rename from app/labyrinth/Labyrinth/Lens.hs rename to app/labyrinth/src/Labyrinth/Lens.hs diff --git a/app/labyrinth/Labyrinth/Prelude.hs b/app/labyrinth/src/Labyrinth/Prelude.hs similarity index 100% rename from app/labyrinth/Labyrinth/Prelude.hs rename to app/labyrinth/src/Labyrinth/Prelude.hs diff --git a/app/labyrinth/Labyrinth/Render.hs b/app/labyrinth/src/Labyrinth/Render.hs similarity index 100% rename from app/labyrinth/Labyrinth/Render.hs rename to app/labyrinth/src/Labyrinth/Render.hs diff --git a/app/labyrinth/Labyrinth/Types.hs b/app/labyrinth/src/Labyrinth/Types.hs similarity index 100% rename from app/labyrinth/Labyrinth/Types.hs rename to app/labyrinth/src/Labyrinth/Types.hs diff --git a/app/labyrinth/Main.hs b/app/labyrinth/src/Main.hs similarity index 100% rename from app/labyrinth/Main.hs rename to app/labyrinth/src/Main.hs diff --git a/lib/Hydra/package.yaml b/lib/Hydra/package.yaml new file mode 100644 index 0000000..c284ff2 --- /dev/null +++ b/lib/Hydra/package.yaml @@ -0,0 +1,135 @@ +name: Hydra +version: 1.1.0.0 +github: "graninas/Hydra" +license: BSD3 +author: "Alexander Granin" +maintainer: "graninas@gmail.com" +copyright: "Granin A.S. 2020" + +description: + All-in-one framework for writing web backends and cli applications. + +default-extensions: +- NoImplicitPrelude +- GADTs +- RankNTypes +- DeriveFunctor +- DeriveGeneric +- OverloadedStrings +- LambdaCase +- MultiParamTypeClasses +- ExplicitNamespaces +- TypeApplications +- ScopedTypeVariables +- TypeOperators +- TypeFamilies +- DataKinds +- FlexibleContexts +- FlexibleInstances +- PatternSynonyms +- PolyKinds +- DefaultSignatures +- ConstraintKinds +- NamedFieldPuns +- TupleSections +- ViewPatterns +- MultiWayIf +- RecordWildCards + +dependencies: +- base >= 4.7 && < 5 +- bytestring +- time-units +- network +- aeson +- aeson-pretty +- cereal +- mtl +- cryptonite +- base16-bytestring +- base58-bytestring +- base64-bytestring +- arithmoi +- directory +- filepath +- process +- extra +- time +- clock +- vector +- scientific +- containers +- random +- free +- iproute +- memory +- transformers +- template-haskell +- async +- text +- haskeline +- cryptohash-sha256 +- bytestring-conversion +- newtype-generics +- lens +- universum +- fmt +- stm +- hslogger +- lens-aeson +- th-abstraction +- MonadRandom +- entropy +- validation +- silently +- uuid +- resourcet +- triplesec +- yaml +- newtype-generics +- regex-posix +- safe-exceptions +- unliftio +- unliftio-core +- rocksdb-haskell +- hedis +- beam-core +- beam-postgres +- beam-sqlite +- beam-migrate +- sqlite-simple +- resource-pool +- servant +- servant-server +- servant-client +- servant-swagger +- servant-docs +- wai +- warp +- http-client +- http-client-tls +- data-default +- generic-lens + +library: + source-dirs: + - src + ghc-options: + - -Wall + + +tests: + functional-tests: + main: Spec.hs + source-dirs: + - test + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - hspec + - HUnit + - QuickCheck + - hspec-contrib + - Hydra diff --git a/src/Hydra/ChurchI.hs b/lib/Hydra/src/Hydra/ChurchI.hs similarity index 100% rename from src/Hydra/ChurchI.hs rename to lib/Hydra/src/Hydra/ChurchI.hs diff --git a/src/Hydra/ChurchL.hs b/lib/Hydra/src/Hydra/ChurchL.hs similarity index 100% rename from src/Hydra/ChurchL.hs rename to lib/Hydra/src/Hydra/ChurchL.hs diff --git a/src/Hydra/Class.hs b/lib/Hydra/src/Hydra/Class.hs similarity index 100% rename from src/Hydra/Class.hs rename to lib/Hydra/src/Hydra/Class.hs diff --git a/src/Hydra/Core/ChurchI.hs b/lib/Hydra/src/Hydra/Core/ChurchI.hs similarity index 100% rename from src/Hydra/Core/ChurchI.hs rename to lib/Hydra/src/Hydra/Core/ChurchI.hs diff --git a/src/Hydra/Core/ChurchL.hs b/lib/Hydra/src/Hydra/Core/ChurchL.hs similarity index 100% rename from src/Hydra/Core/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/ChurchL.hs diff --git a/src/Hydra/Core/Class.hs b/lib/Hydra/src/Hydra/Core/Class.hs similarity index 100% rename from src/Hydra/Core/Class.hs rename to lib/Hydra/src/Hydra/Core/Class.hs diff --git a/src/Hydra/Core/CliHandlers/Interpreter.hs b/lib/Hydra/src/Hydra/Core/CliHandlers/Interpreter.hs similarity index 100% rename from src/Hydra/Core/CliHandlers/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/CliHandlers/Interpreter.hs diff --git a/src/Hydra/Core/CliHandlers/Language.hs b/lib/Hydra/src/Hydra/Core/CliHandlers/Language.hs similarity index 100% rename from src/Hydra/Core/CliHandlers/Language.hs rename to lib/Hydra/src/Hydra/Core/CliHandlers/Language.hs diff --git a/src/Hydra/Core/ControlFlow/ChurchI.hs b/lib/Hydra/src/Hydra/Core/ControlFlow/ChurchI.hs similarity index 100% rename from src/Hydra/Core/ControlFlow/ChurchI.hs rename to lib/Hydra/src/Hydra/Core/ControlFlow/ChurchI.hs diff --git a/src/Hydra/Core/ControlFlow/ChurchL.hs b/lib/Hydra/src/Hydra/Core/ControlFlow/ChurchL.hs similarity index 100% rename from src/Hydra/Core/ControlFlow/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/ControlFlow/ChurchL.hs diff --git a/src/Hydra/Core/ControlFlow/Class.hs b/lib/Hydra/src/Hydra/Core/ControlFlow/Class.hs similarity index 100% rename from src/Hydra/Core/ControlFlow/Class.hs rename to lib/Hydra/src/Hydra/Core/ControlFlow/Class.hs diff --git a/src/Hydra/Core/ControlFlow/FTL.hs b/lib/Hydra/src/Hydra/Core/ControlFlow/FTL.hs similarity index 100% rename from src/Hydra/Core/ControlFlow/FTL.hs rename to lib/Hydra/src/Hydra/Core/ControlFlow/FTL.hs diff --git a/src/Hydra/Core/ControlFlow/Interpreter.hs b/lib/Hydra/src/Hydra/Core/ControlFlow/Interpreter.hs similarity index 100% rename from src/Hydra/Core/ControlFlow/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/ControlFlow/Interpreter.hs diff --git a/src/Hydra/Core/ControlFlow/Language.hs b/lib/Hydra/src/Hydra/Core/ControlFlow/Language.hs similarity index 100% rename from src/Hydra/Core/ControlFlow/Language.hs rename to lib/Hydra/src/Hydra/Core/ControlFlow/Language.hs diff --git a/src/Hydra/Core/Domain.hs b/lib/Hydra/src/Hydra/Core/Domain.hs similarity index 100% rename from src/Hydra/Core/Domain.hs rename to lib/Hydra/src/Hydra/Core/Domain.hs diff --git a/src/Hydra/Core/Domain/Cli.hs b/lib/Hydra/src/Hydra/Core/Domain/Cli.hs similarity index 100% rename from src/Hydra/Core/Domain/Cli.hs rename to lib/Hydra/src/Hydra/Core/Domain/Cli.hs diff --git a/src/Hydra/Core/Domain/DB.hs b/lib/Hydra/src/Hydra/Core/Domain/DB.hs similarity index 100% rename from src/Hydra/Core/Domain/DB.hs rename to lib/Hydra/src/Hydra/Core/Domain/DB.hs diff --git a/src/Hydra/Core/Domain/KVDB.hs b/lib/Hydra/src/Hydra/Core/Domain/KVDB.hs similarity index 100% rename from src/Hydra/Core/Domain/KVDB.hs rename to lib/Hydra/src/Hydra/Core/Domain/KVDB.hs diff --git a/src/Hydra/Core/Domain/Logger.hs b/lib/Hydra/src/Hydra/Core/Domain/Logger.hs similarity index 100% rename from src/Hydra/Core/Domain/Logger.hs rename to lib/Hydra/src/Hydra/Core/Domain/Logger.hs diff --git a/src/Hydra/Core/Domain/Process.hs b/lib/Hydra/src/Hydra/Core/Domain/Process.hs similarity index 100% rename from src/Hydra/Core/Domain/Process.hs rename to lib/Hydra/src/Hydra/Core/Domain/Process.hs diff --git a/src/Hydra/Core/Domain/SQLDB.hs b/lib/Hydra/src/Hydra/Core/Domain/SQLDB.hs similarity index 100% rename from src/Hydra/Core/Domain/SQLDB.hs rename to lib/Hydra/src/Hydra/Core/Domain/SQLDB.hs diff --git a/src/Hydra/Core/Domain/State.hs b/lib/Hydra/src/Hydra/Core/Domain/State.hs similarity index 100% rename from src/Hydra/Core/Domain/State.hs rename to lib/Hydra/src/Hydra/Core/Domain/State.hs diff --git a/src/Hydra/Core/FTL.hs b/lib/Hydra/src/Hydra/Core/FTL.hs similarity index 100% rename from src/Hydra/Core/FTL.hs rename to lib/Hydra/src/Hydra/Core/FTL.hs diff --git a/src/Hydra/Core/FTLI.hs b/lib/Hydra/src/Hydra/Core/FTLI.hs similarity index 100% rename from src/Hydra/Core/FTLI.hs rename to lib/Hydra/src/Hydra/Core/FTLI.hs diff --git a/src/Hydra/Core/Interpreters.hs b/lib/Hydra/src/Hydra/Core/Interpreters.hs similarity index 100% rename from src/Hydra/Core/Interpreters.hs rename to lib/Hydra/src/Hydra/Core/Interpreters.hs diff --git a/src/Hydra/Core/KVDB/Impl/Redis.hs b/lib/Hydra/src/Hydra/Core/KVDB/Impl/Redis.hs similarity index 100% rename from src/Hydra/Core/KVDB/Impl/Redis.hs rename to lib/Hydra/src/Hydra/Core/KVDB/Impl/Redis.hs diff --git a/src/Hydra/Core/KVDB/Impl/RocksDB.hs b/lib/Hydra/src/Hydra/Core/KVDB/Impl/RocksDB.hs similarity index 100% rename from src/Hydra/Core/KVDB/Impl/RocksDB.hs rename to lib/Hydra/src/Hydra/Core/KVDB/Impl/RocksDB.hs diff --git a/src/Hydra/Core/KVDB/Interpreter.hs b/lib/Hydra/src/Hydra/Core/KVDB/Interpreter.hs similarity index 100% rename from src/Hydra/Core/KVDB/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/KVDB/Interpreter.hs diff --git a/src/Hydra/Core/KVDB/Language.hs b/lib/Hydra/src/Hydra/Core/KVDB/Language.hs similarity index 93% rename from src/Hydra/Core/KVDB/Language.hs rename to lib/Hydra/src/Hydra/Core/KVDB/Language.hs index df9fea4..d71c55d 100644 --- a/src/Hydra/Core/KVDB/Language.hs +++ b/lib/Hydra/src/Hydra/Core/KVDB/Language.hs @@ -9,13 +9,13 @@ import Hydra.Prelude import qualified Hydra.Core.Domain.DB as D import qualified Hydra.Core.Domain.KVDB as D -import Language.Haskell.TH.MakeFunctor (makeFunctorInstance) - data KVDBF next where Save :: D.KVDBKey -> D.KVDBValue -> (D.DBResult () -> next) -> KVDBF next Load :: D.KVDBKey -> (D.DBResult D.KVDBValue -> next) -> KVDBF next -makeFunctorInstance ''KVDBF +instance Functor KVDBF where + fmap g (Save k v next) = Save k v (g . next) + fmap g (Load k next) = Load k (g . next) type KVDBL db = Free KVDBF diff --git a/src/Hydra/Core/KVDB/Redis/Language.hs b/lib/Hydra/src/Hydra/Core/KVDB/Redis/Language.hs similarity index 100% rename from src/Hydra/Core/KVDB/Redis/Language.hs rename to lib/Hydra/src/Hydra/Core/KVDB/Redis/Language.hs diff --git a/src/Hydra/Core/KVDBRuntime.hs b/lib/Hydra/src/Hydra/Core/KVDBRuntime.hs similarity index 100% rename from src/Hydra/Core/KVDBRuntime.hs rename to lib/Hydra/src/Hydra/Core/KVDBRuntime.hs diff --git a/src/Hydra/Core/Lang/ChurchI.hs b/lib/Hydra/src/Hydra/Core/Lang/ChurchI.hs similarity index 100% rename from src/Hydra/Core/Lang/ChurchI.hs rename to lib/Hydra/src/Hydra/Core/Lang/ChurchI.hs diff --git a/src/Hydra/Core/Lang/ChurchL.hs b/lib/Hydra/src/Hydra/Core/Lang/ChurchL.hs similarity index 86% rename from src/Hydra/Core/Lang/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/Lang/ChurchL.hs index c6bf599..e0eb667 100644 --- a/src/Hydra/Core/Lang/ChurchL.hs +++ b/lib/Hydra/src/Hydra/Core/Lang/ChurchL.hs @@ -16,8 +16,6 @@ import qualified Hydra.Core.State.ChurchL as CL import qualified Hydra.Core.State.Class as C import qualified Hydra.Core.Lang.Class as C -import Language.Haskell.TH.MakeFunctor (makeFunctorInstance) - -- | Core effects container language. data LangF next where -- | Eval stateful action atomically. @@ -33,7 +31,12 @@ data LangF next where -- TODO: KVDB -makeFunctorInstance ''LangF +instance Functor LangF where + fmap f (EvalStateAtomically act next) = EvalStateAtomically act (f . next) + fmap f (EvalLogger act next) = EvalLogger act (f . next) + fmap f (EvalRandom act next) = EvalRandom act (f . next) + fmap f (EvalControlFlow act next) = EvalControlFlow act (f . next) + fmap f (EvalIO act next) = EvalIO act (f . next) type LangL = F LangF diff --git a/src/Hydra/Core/Lang/Class.hs b/lib/Hydra/src/Hydra/Core/Lang/Class.hs similarity index 100% rename from src/Hydra/Core/Lang/Class.hs rename to lib/Hydra/src/Hydra/Core/Lang/Class.hs diff --git a/src/Hydra/Core/Lang/FTL.hs b/lib/Hydra/src/Hydra/Core/Lang/FTL.hs similarity index 100% rename from src/Hydra/Core/Lang/FTL.hs rename to lib/Hydra/src/Hydra/Core/Lang/FTL.hs diff --git a/src/Hydra/Core/Lang/FTLI.hs b/lib/Hydra/src/Hydra/Core/Lang/FTLI.hs similarity index 100% rename from src/Hydra/Core/Lang/FTLI.hs rename to lib/Hydra/src/Hydra/Core/Lang/FTLI.hs diff --git a/src/Hydra/Core/Lang/Interpreter.hs b/lib/Hydra/src/Hydra/Core/Lang/Interpreter.hs similarity index 100% rename from src/Hydra/Core/Lang/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/Lang/Interpreter.hs diff --git a/src/Hydra/Core/Lang/Language.hs b/lib/Hydra/src/Hydra/Core/Lang/Language.hs similarity index 100% rename from src/Hydra/Core/Lang/Language.hs rename to lib/Hydra/src/Hydra/Core/Lang/Language.hs diff --git a/src/Hydra/Core/Language.hs b/lib/Hydra/src/Hydra/Core/Language.hs similarity index 100% rename from src/Hydra/Core/Language.hs rename to lib/Hydra/src/Hydra/Core/Language.hs diff --git a/src/Hydra/Core/Logger/ChurchL.hs b/lib/Hydra/src/Hydra/Core/Logger/ChurchL.hs similarity index 100% rename from src/Hydra/Core/Logger/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/Logger/ChurchL.hs diff --git a/src/Hydra/Core/Logger/Class.hs b/lib/Hydra/src/Hydra/Core/Logger/Class.hs similarity index 100% rename from src/Hydra/Core/Logger/Class.hs rename to lib/Hydra/src/Hydra/Core/Logger/Class.hs diff --git a/src/Hydra/Core/Logger/FTL.hs b/lib/Hydra/src/Hydra/Core/Logger/FTL.hs similarity index 100% rename from src/Hydra/Core/Logger/FTL.hs rename to lib/Hydra/src/Hydra/Core/Logger/FTL.hs diff --git a/src/Hydra/Core/Logger/FTLI.hs b/lib/Hydra/src/Hydra/Core/Logger/FTLI.hs similarity index 100% rename from src/Hydra/Core/Logger/FTLI.hs rename to lib/Hydra/src/Hydra/Core/Logger/FTLI.hs diff --git a/src/Hydra/Core/Logger/Impl/HsLogger.hs b/lib/Hydra/src/Hydra/Core/Logger/Impl/HsLogger.hs similarity index 100% rename from src/Hydra/Core/Logger/Impl/HsLogger.hs rename to lib/Hydra/src/Hydra/Core/Logger/Impl/HsLogger.hs diff --git a/src/Hydra/Core/Logger/Impl/HsLoggerChurchI.hs b/lib/Hydra/src/Hydra/Core/Logger/Impl/HsLoggerChurchI.hs similarity index 100% rename from src/Hydra/Core/Logger/Impl/HsLoggerChurchI.hs rename to lib/Hydra/src/Hydra/Core/Logger/Impl/HsLoggerChurchI.hs diff --git a/src/Hydra/Core/Logger/Impl/HsLoggerInterpreter.hs b/lib/Hydra/src/Hydra/Core/Logger/Impl/HsLoggerInterpreter.hs similarity index 100% rename from src/Hydra/Core/Logger/Impl/HsLoggerInterpreter.hs rename to lib/Hydra/src/Hydra/Core/Logger/Impl/HsLoggerInterpreter.hs diff --git a/src/Hydra/Core/Logger/Impl/StmLogger.hs b/lib/Hydra/src/Hydra/Core/Logger/Impl/StmLogger.hs similarity index 100% rename from src/Hydra/Core/Logger/Impl/StmLogger.hs rename to lib/Hydra/src/Hydra/Core/Logger/Impl/StmLogger.hs diff --git a/src/Hydra/Core/Logger/Impl/StmLoggerChurch.hs b/lib/Hydra/src/Hydra/Core/Logger/Impl/StmLoggerChurch.hs similarity index 100% rename from src/Hydra/Core/Logger/Impl/StmLoggerChurch.hs rename to lib/Hydra/src/Hydra/Core/Logger/Impl/StmLoggerChurch.hs diff --git a/src/Hydra/Core/Logger/Language.hs b/lib/Hydra/src/Hydra/Core/Logger/Language.hs similarity index 83% rename from src/Hydra/Core/Logger/Language.hs rename to lib/Hydra/src/Hydra/Core/Logger/Language.hs index cbc2e73..9aa12b8 100644 --- a/src/Hydra/Core/Logger/Language.hs +++ b/lib/Hydra/src/Hydra/Core/Logger/Language.hs @@ -9,14 +9,15 @@ import qualified Hydra.Core.Domain as D import Hydra.Core.Logger.Class -import Language.Haskell.TH.MakeFunctor -- | Language for logging. data LoggerF next where -- | Log message with a predefined level. LogMessage :: !D.LogLevel -> !D.Message -> (() -> next) -> LoggerF next -makeFunctorInstance ''LoggerF +instance Functor LoggerF where + fmap f (LogMessage lvl msg next) = LogMessage lvl msg (f . next) + type LoggerL = Free LoggerF diff --git a/src/Hydra/Core/Process/ChurchI.hs b/lib/Hydra/src/Hydra/Core/Process/ChurchI.hs similarity index 100% rename from src/Hydra/Core/Process/ChurchI.hs rename to lib/Hydra/src/Hydra/Core/Process/ChurchI.hs diff --git a/src/Hydra/Core/Process/ChurchL.hs b/lib/Hydra/src/Hydra/Core/Process/ChurchL.hs similarity index 100% rename from src/Hydra/Core/Process/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/Process/ChurchL.hs diff --git a/src/Hydra/Core/Process/Class.hs b/lib/Hydra/src/Hydra/Core/Process/Class.hs similarity index 100% rename from src/Hydra/Core/Process/Class.hs rename to lib/Hydra/src/Hydra/Core/Process/Class.hs diff --git a/src/Hydra/Core/Process/FTL.hs b/lib/Hydra/src/Hydra/Core/Process/FTL.hs similarity index 100% rename from src/Hydra/Core/Process/FTL.hs rename to lib/Hydra/src/Hydra/Core/Process/FTL.hs diff --git a/src/Hydra/Core/Process/FTLI.hs b/lib/Hydra/src/Hydra/Core/Process/FTLI.hs similarity index 100% rename from src/Hydra/Core/Process/FTLI.hs rename to lib/Hydra/src/Hydra/Core/Process/FTLI.hs diff --git a/src/Hydra/Core/Process/Impl.hs b/lib/Hydra/src/Hydra/Core/Process/Impl.hs similarity index 100% rename from src/Hydra/Core/Process/Impl.hs rename to lib/Hydra/src/Hydra/Core/Process/Impl.hs diff --git a/src/Hydra/Core/Process/Interpreter.hs b/lib/Hydra/src/Hydra/Core/Process/Interpreter.hs similarity index 100% rename from src/Hydra/Core/Process/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/Process/Interpreter.hs diff --git a/src/Hydra/Core/Process/Language.hs b/lib/Hydra/src/Hydra/Core/Process/Language.hs similarity index 100% rename from src/Hydra/Core/Process/Language.hs rename to lib/Hydra/src/Hydra/Core/Process/Language.hs diff --git a/src/Hydra/Core/RLens.hs b/lib/Hydra/src/Hydra/Core/RLens.hs similarity index 100% rename from src/Hydra/Core/RLens.hs rename to lib/Hydra/src/Hydra/Core/RLens.hs diff --git a/src/Hydra/Core/Random/ChurchI.hs b/lib/Hydra/src/Hydra/Core/Random/ChurchI.hs similarity index 100% rename from src/Hydra/Core/Random/ChurchI.hs rename to lib/Hydra/src/Hydra/Core/Random/ChurchI.hs diff --git a/src/Hydra/Core/Random/ChurchL.hs b/lib/Hydra/src/Hydra/Core/Random/ChurchL.hs similarity index 100% rename from src/Hydra/Core/Random/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/Random/ChurchL.hs diff --git a/src/Hydra/Core/Random/Class.hs b/lib/Hydra/src/Hydra/Core/Random/Class.hs similarity index 100% rename from src/Hydra/Core/Random/Class.hs rename to lib/Hydra/src/Hydra/Core/Random/Class.hs diff --git a/src/Hydra/Core/Random/FTL.hs b/lib/Hydra/src/Hydra/Core/Random/FTL.hs similarity index 100% rename from src/Hydra/Core/Random/FTL.hs rename to lib/Hydra/src/Hydra/Core/Random/FTL.hs diff --git a/src/Hydra/Core/Random/FTLI.hs b/lib/Hydra/src/Hydra/Core/Random/FTLI.hs similarity index 100% rename from src/Hydra/Core/Random/FTLI.hs rename to lib/Hydra/src/Hydra/Core/Random/FTLI.hs diff --git a/src/Hydra/Core/Random/Interpreter.hs b/lib/Hydra/src/Hydra/Core/Random/Interpreter.hs similarity index 100% rename from src/Hydra/Core/Random/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/Random/Interpreter.hs diff --git a/src/Hydra/Core/Random/Language.hs b/lib/Hydra/src/Hydra/Core/Random/Language.hs similarity index 64% rename from src/Hydra/Core/Random/Language.hs rename to lib/Hydra/src/Hydra/Core/Random/Language.hs index 68fbd6b..ee4f0e0 100644 --- a/src/Hydra/Core/Random/Language.hs +++ b/lib/Hydra/src/Hydra/Core/Random/Language.hs @@ -7,14 +7,15 @@ import Hydra.Prelude import Hydra.Core.Random.Class -import Language.Haskell.TH.MakeFunctor -- | Language for Random. data RandomF next where - -- | Get Int from range - GetRandomInt :: (Int, Int) -> (Int -> next) -> RandomF next + -- | Get Int from range + GetRandomInt :: (Int, Int) -> (Int -> next) -> RandomF next + +instance Functor RandomF where + fmap f (GetRandomInt range next) = GetRandomInt range (f . next) -makeFunctorInstance ''RandomF type RandomL = Free RandomF diff --git a/src/Hydra/Core/Runtime.hs b/lib/Hydra/src/Hydra/Core/Runtime.hs similarity index 100% rename from src/Hydra/Core/Runtime.hs rename to lib/Hydra/src/Hydra/Core/Runtime.hs diff --git a/src/Hydra/Core/SqlDB/Interpreter.hs b/lib/Hydra/src/Hydra/Core/SqlDB/Interpreter.hs similarity index 100% rename from src/Hydra/Core/SqlDB/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/SqlDB/Interpreter.hs diff --git a/src/Hydra/Core/SqlDB/Language.hs b/lib/Hydra/src/Hydra/Core/SqlDB/Language.hs similarity index 100% rename from src/Hydra/Core/SqlDB/Language.hs rename to lib/Hydra/src/Hydra/Core/SqlDB/Language.hs diff --git a/src/Hydra/Core/SqlDBRuntime.hs b/lib/Hydra/src/Hydra/Core/SqlDBRuntime.hs similarity index 100% rename from src/Hydra/Core/SqlDBRuntime.hs rename to lib/Hydra/src/Hydra/Core/SqlDBRuntime.hs diff --git a/src/Hydra/Core/State/ChurchI.hs b/lib/Hydra/src/Hydra/Core/State/ChurchI.hs similarity index 100% rename from src/Hydra/Core/State/ChurchI.hs rename to lib/Hydra/src/Hydra/Core/State/ChurchI.hs diff --git a/src/Hydra/Core/State/ChurchL.hs b/lib/Hydra/src/Hydra/Core/State/ChurchL.hs similarity index 76% rename from src/Hydra/Core/State/ChurchL.hs rename to lib/Hydra/src/Hydra/Core/State/ChurchL.hs index 5f2cf07..cc6469a 100644 --- a/src/Hydra/Core/State/ChurchL.hs +++ b/lib/Hydra/src/Hydra/Core/State/ChurchL.hs @@ -10,8 +10,6 @@ import qualified Hydra.Core.Logger.ChurchL as CL import qualified Hydra.Core.Logger.Class as L import qualified Hydra.Core.State.Class as L -import Language.Haskell.TH.MakeFunctor - -- | State language. It reflects STM and its behavior. data StateF next where -- | Create variable. @@ -25,7 +23,14 @@ data StateF next where -- | Eval "delayed" logger: it will be written after successfull state operation. EvalStmLogger :: CL.LoggerL () -> (() -> next) -> StateF next -makeFunctorInstance ''StateF + +instance Functor StateF where + fmap f (NewVar val next) = NewVar val (f . next) + fmap f (ReadVar var next) = ReadVar var (f . next) + fmap f (WriteVar var val next) = WriteVar var val (f . next) + fmap f (Retry next) = Retry (f . next) + fmap f (EvalStmLogger logActt next) = EvalStmLogger logActt (f . next) + type StateL = F StateF diff --git a/src/Hydra/Core/State/Class.hs b/lib/Hydra/src/Hydra/Core/State/Class.hs similarity index 100% rename from src/Hydra/Core/State/Class.hs rename to lib/Hydra/src/Hydra/Core/State/Class.hs diff --git a/src/Hydra/Core/State/FTL.hs b/lib/Hydra/src/Hydra/Core/State/FTL.hs similarity index 100% rename from src/Hydra/Core/State/FTL.hs rename to lib/Hydra/src/Hydra/Core/State/FTL.hs diff --git a/src/Hydra/Core/State/Interpreter.hs b/lib/Hydra/src/Hydra/Core/State/Interpreter.hs similarity index 100% rename from src/Hydra/Core/State/Interpreter.hs rename to lib/Hydra/src/Hydra/Core/State/Interpreter.hs diff --git a/src/Hydra/Core/State/Language.hs b/lib/Hydra/src/Hydra/Core/State/Language.hs similarity index 76% rename from src/Hydra/Core/State/Language.hs rename to lib/Hydra/src/Hydra/Core/State/Language.hs index d750a06..29a951c 100644 --- a/src/Hydra/Core/State/Language.hs +++ b/lib/Hydra/src/Hydra/Core/State/Language.hs @@ -10,8 +10,6 @@ import qualified Hydra.Core.Logger.Class as L import qualified Hydra.Core.Logger.Language as L import qualified Hydra.Core.State.Class as L -import Language.Haskell.TH.MakeFunctor - -- | State language. It reflects STM and its behavior. data StateF next where -- | Create variable. @@ -25,7 +23,13 @@ data StateF next where -- | Eval "delayed" logger: it will be written after successfull state operation. EvalStmLogger :: L.LoggerL () -> (() -> next) -> StateF next -makeFunctorInstance ''StateF +instance Functor StateF where + fmap f (NewVar val next) = NewVar val (f . next) + fmap f (ReadVar var next) = ReadVar var (f . next) + fmap f (WriteVar var val next) = WriteVar var val (f . next) + fmap f (Retry next) = Retry (f . next) + fmap f (EvalStmLogger logActt next) = EvalStmLogger logActt (f . next) + type StateL = Free StateF diff --git a/src/Hydra/Core/State/STM.hs b/lib/Hydra/src/Hydra/Core/State/STM.hs similarity index 100% rename from src/Hydra/Core/State/STM.hs rename to lib/Hydra/src/Hydra/Core/State/STM.hs diff --git a/src/Hydra/Domain.hs b/lib/Hydra/src/Hydra/Domain.hs similarity index 100% rename from src/Hydra/Domain.hs rename to lib/Hydra/src/Hydra/Domain.hs diff --git a/src/Hydra/FTL.hs b/lib/Hydra/src/Hydra/FTL.hs similarity index 100% rename from src/Hydra/FTL.hs rename to lib/Hydra/src/Hydra/FTL.hs diff --git a/src/Hydra/FTLI.hs b/lib/Hydra/src/Hydra/FTLI.hs similarity index 100% rename from src/Hydra/FTLI.hs rename to lib/Hydra/src/Hydra/FTLI.hs diff --git a/src/Hydra/Framework/App/ChurchI.hs b/lib/Hydra/src/Hydra/Framework/App/ChurchI.hs similarity index 100% rename from src/Hydra/Framework/App/ChurchI.hs rename to lib/Hydra/src/Hydra/Framework/App/ChurchI.hs diff --git a/src/Hydra/Framework/App/ChurchL.hs b/lib/Hydra/src/Hydra/Framework/App/ChurchL.hs similarity index 92% rename from src/Hydra/Framework/App/ChurchL.hs rename to lib/Hydra/src/Hydra/Framework/App/ChurchL.hs index 9e60652..cdb3056 100644 --- a/src/Hydra/Framework/App/ChurchL.hs +++ b/lib/Hydra/src/Hydra/Framework/App/ChurchL.hs @@ -10,7 +10,6 @@ import qualified Hydra.Core.ChurchL as L import qualified Hydra.Core.Class as C import qualified Hydra.Core.Domain as D -import Language.Haskell.TH.MakeFunctor (makeFunctorInstance) -- | Core effects container language. data AppF next where @@ -19,7 +18,10 @@ data AppF next where -- | Eval lang. EvalLang :: L.LangL a -> (a -> next) -> AppF next -makeFunctorInstance ''AppF +instance Functor AppF where + fmap f (EvalProcess act next) = EvalProcess act (f . next) + fmap f (EvalLang act next) = EvalLang act (f . next) + type AppL = F AppF diff --git a/src/Hydra/Framework/App/Class.hs b/lib/Hydra/src/Hydra/Framework/App/Class.hs similarity index 90% rename from src/Hydra/Framework/App/Class.hs rename to lib/Hydra/src/Hydra/Framework/App/Class.hs index 863fc0f..dc7e302 100644 --- a/src/Hydra/Framework/App/Class.hs +++ b/lib/Hydra/src/Hydra/Framework/App/Class.hs @@ -10,7 +10,6 @@ import Hydra.Prelude import qualified Hydra.Core.Class as C import qualified Hydra.Core.Domain as D -import Language.Haskell.TH.MakeFunctor (makeFunctorInstance) -- TODO: this is awful -- class (C.Logger l, C.Random r, C.ControlFlow cf, C.State' s, diff --git a/src/Hydra/Framework/App/FTL.hs b/lib/Hydra/src/Hydra/Framework/App/FTL.hs similarity index 100% rename from src/Hydra/Framework/App/FTL.hs rename to lib/Hydra/src/Hydra/Framework/App/FTL.hs diff --git a/src/Hydra/Framework/App/FTLI.hs b/lib/Hydra/src/Hydra/Framework/App/FTLI.hs similarity index 100% rename from src/Hydra/Framework/App/FTLI.hs rename to lib/Hydra/src/Hydra/Framework/App/FTLI.hs diff --git a/src/Hydra/Framework/App/Interpreter.hs b/lib/Hydra/src/Hydra/Framework/App/Interpreter.hs similarity index 100% rename from src/Hydra/Framework/App/Interpreter.hs rename to lib/Hydra/src/Hydra/Framework/App/Interpreter.hs diff --git a/src/Hydra/Framework/App/Language.hs b/lib/Hydra/src/Hydra/Framework/App/Language.hs similarity index 100% rename from src/Hydra/Framework/App/Language.hs rename to lib/Hydra/src/Hydra/Framework/App/Language.hs diff --git a/src/Hydra/Framework/ChurchI.hs b/lib/Hydra/src/Hydra/Framework/ChurchI.hs similarity index 100% rename from src/Hydra/Framework/ChurchI.hs rename to lib/Hydra/src/Hydra/Framework/ChurchI.hs diff --git a/src/Hydra/Framework/ChurchL.hs b/lib/Hydra/src/Hydra/Framework/ChurchL.hs similarity index 100% rename from src/Hydra/Framework/ChurchL.hs rename to lib/Hydra/src/Hydra/Framework/ChurchL.hs diff --git a/src/Hydra/Framework/Class.hs b/lib/Hydra/src/Hydra/Framework/Class.hs similarity index 100% rename from src/Hydra/Framework/Class.hs rename to lib/Hydra/src/Hydra/Framework/Class.hs diff --git a/src/Hydra/Framework/FTL.hs b/lib/Hydra/src/Hydra/Framework/FTL.hs similarity index 100% rename from src/Hydra/Framework/FTL.hs rename to lib/Hydra/src/Hydra/Framework/FTL.hs diff --git a/src/Hydra/Framework/FTLI.hs b/lib/Hydra/src/Hydra/Framework/FTLI.hs similarity index 100% rename from src/Hydra/Framework/FTLI.hs rename to lib/Hydra/src/Hydra/Framework/FTLI.hs diff --git a/src/Hydra/Framework/Interpreters.hs b/lib/Hydra/src/Hydra/Framework/Interpreters.hs similarity index 100% rename from src/Hydra/Framework/Interpreters.hs rename to lib/Hydra/src/Hydra/Framework/Interpreters.hs diff --git a/src/Hydra/Framework/Language.hs b/lib/Hydra/src/Hydra/Framework/Language.hs similarity index 100% rename from src/Hydra/Framework/Language.hs rename to lib/Hydra/src/Hydra/Framework/Language.hs diff --git a/src/Hydra/Framework/RLens.hs b/lib/Hydra/src/Hydra/Framework/RLens.hs similarity index 100% rename from src/Hydra/Framework/RLens.hs rename to lib/Hydra/src/Hydra/Framework/RLens.hs diff --git a/src/Hydra/Framework/Runtime.hs b/lib/Hydra/src/Hydra/Framework/Runtime.hs similarity index 100% rename from src/Hydra/Framework/Runtime.hs rename to lib/Hydra/src/Hydra/Framework/Runtime.hs diff --git a/src/Hydra/Interpreters.hs b/lib/Hydra/src/Hydra/Interpreters.hs similarity index 100% rename from src/Hydra/Interpreters.hs rename to lib/Hydra/src/Hydra/Interpreters.hs diff --git a/src/Hydra/Language.hs b/lib/Hydra/src/Hydra/Language.hs similarity index 100% rename from src/Hydra/Language.hs rename to lib/Hydra/src/Hydra/Language.hs diff --git a/src/Hydra/Language/Extra.hs b/lib/Hydra/src/Hydra/Language/Extra.hs similarity index 100% rename from src/Hydra/Language/Extra.hs rename to lib/Hydra/src/Hydra/Language/Extra.hs diff --git a/src/Hydra/Prelude.hs b/lib/Hydra/src/Hydra/Prelude.hs similarity index 100% rename from src/Hydra/Prelude.hs rename to lib/Hydra/src/Hydra/Prelude.hs diff --git a/src/Hydra/Runtime.hs b/lib/Hydra/src/Hydra/Runtime.hs similarity index 100% rename from src/Hydra/Runtime.hs rename to lib/Hydra/src/Hydra/Runtime.hs diff --git a/test.db b/lib/Hydra/test.db similarity index 100% rename from test.db rename to lib/Hydra/test.db diff --git a/test/spec/Hydra/TestData.hs b/lib/Hydra/test/Hydra/TestData.hs similarity index 100% rename from test/spec/Hydra/TestData.hs rename to lib/Hydra/test/Hydra/TestData.hs diff --git a/test/spec/Hydra/TestData/Types/KVDB/CatalogueDB.hs b/lib/Hydra/test/Hydra/TestData/Types/KVDB/CatalogueDB.hs similarity index 100% rename from test/spec/Hydra/TestData/Types/KVDB/CatalogueDB.hs rename to lib/Hydra/test/Hydra/TestData/Types/KVDB/CatalogueDB.hs diff --git a/test/spec/Hydra/TestData/Types/Meteor.hs b/lib/Hydra/test/Hydra/TestData/Types/Meteor.hs similarity index 100% rename from test/spec/Hydra/TestData/Types/Meteor.hs rename to lib/Hydra/test/Hydra/TestData/Types/Meteor.hs diff --git a/test/spec/Hydra/TestData/Types/SqlDB/CatalogueDB.hs b/lib/Hydra/test/Hydra/TestData/Types/SqlDB/CatalogueDB.hs similarity index 100% rename from test/spec/Hydra/TestData/Types/SqlDB/CatalogueDB.hs rename to lib/Hydra/test/Hydra/TestData/Types/SqlDB/CatalogueDB.hs diff --git a/test/spec/Hydra/Testing/Integrational.hs b/lib/Hydra/test/Hydra/Testing/Integrational.hs similarity index 100% rename from test/spec/Hydra/Testing/Integrational.hs rename to lib/Hydra/test/Hydra/Testing/Integrational.hs diff --git a/test/spec/Hydra/Testing/Wrappers.hs b/lib/Hydra/test/Hydra/Testing/Wrappers.hs similarity index 100% rename from test/spec/Hydra/Testing/Wrappers.hs rename to lib/Hydra/test/Hydra/Testing/Wrappers.hs diff --git a/test/spec/Hydra/Tests/Integration/Common.hs b/lib/Hydra/test/Hydra/Tests/Integration/Common.hs similarity index 100% rename from test/spec/Hydra/Tests/Integration/Common.hs rename to lib/Hydra/test/Hydra/Tests/Integration/Common.hs diff --git a/test/spec/Hydra/Tests/Integration/FrameworkSpec.hs b/lib/Hydra/test/Hydra/Tests/Integration/FrameworkSpec.hs similarity index 100% rename from test/spec/Hydra/Tests/Integration/FrameworkSpec.hs rename to lib/Hydra/test/Hydra/Tests/Integration/FrameworkSpec.hs diff --git a/test/spec/Hydra/Tests/Integration/KVDBSpec.hs b/lib/Hydra/test/Hydra/Tests/Integration/KVDBSpec.hs similarity index 100% rename from test/spec/Hydra/Tests/Integration/KVDBSpec.hs rename to lib/Hydra/test/Hydra/Tests/Integration/KVDBSpec.hs diff --git a/test/spec/Hydra/Tests/Integration/SqlDBSpec.hs b/lib/Hydra/test/Hydra/Tests/Integration/SqlDBSpec.hs similarity index 100% rename from test/spec/Hydra/Tests/Integration/SqlDBSpec.hs rename to lib/Hydra/test/Hydra/Tests/Integration/SqlDBSpec.hs diff --git a/test/spec/Spec.hs b/lib/Hydra/test/Spec.hs similarity index 100% rename from test/spec/Spec.hs rename to lib/Hydra/test/Spec.hs diff --git a/src/Language/Haskell/TH/MakeFunctor.hs b/src/Language/Haskell/TH/MakeFunctor.hs deleted file mode 100644 index 5a36c66..0000000 --- a/src/Language/Haskell/TH/MakeFunctor.hs +++ /dev/null @@ -1,32 +0,0 @@ -module Language.Haskell.TH.MakeFunctor where - -import qualified Data.List as L -import Hydra.Prelude -import Language.Haskell.TH -import Language.Haskell.TH.Datatype - -makeFunctorInstance :: Name -> Q [Dec] -makeFunctorInstance name = - (: []) <$> instanceD (cxt []) (appT (conT $ mkName "Functor") (conT name)) [makeFmap name] - -makeFmap :: Name -> Q Dec -makeFmap name = do - constructors <- datatypeCons <$> reifyDatatype name - funD (mkName "fmap") (map makeFmapBody constructors) - -makeFmapBody :: ConstructorInfo -> Q Clause -makeFmapBody info = do - let argsCount = length $ constructorFields info - let varNames = [ mkName $ "a" <> show a | a <- [1 .. argsCount] ] - let consName = constructorName info - let vars = map VarE $ L.init varNames - let expr = UInfixE (VarE $ mkName "g") (VarE $ mkName ".") (VarE $ last varNames) - clause - [ varP $ mkName "g" - , conP consName (map varP varNames) - ] - (normalB $ foldApp $ ConE consName : vars ++ [expr]) - [] - -foldApp :: [Exp] -> Q Exp -foldApp = pure . foldl1 AppE diff --git a/stack.yaml b/stack.yaml index df398ea..1f96def 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,12 @@ resolver: lts-14.4 packages: -- . +- lib/Hydra +- app/astro +- app/labyrinth +- app/MeteorCounter +- app/PerfTestApp +- app/PerfTestApp2 extra-deps: - base58-bytestring-0.1.0