From a7db5cb667fbb98f3a78b9cfd3637c5fa9456d06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Hamal=20Dvo=C5=99=C3=A1k?= <mordae@anilinux.org>
Date: Mon, 12 Apr 2021 09:12:03 +0200
Subject: [PATCH] Use cabal only
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jan Hamal Dvořák <mordae@anilinux.org>
---
 .gitignore             |   2 +-
 hikaru.cabal           | 220 ++++++++++++++++++++---------------------
 lib/Hikaru/Action.hs   |   2 +-
 lib/Hikaru/Config.hs   |   2 +-
 lib/Hikaru/Form.hs     |  14 +--
 lib/Hikaru/Localize.hs |   2 +-
 package.yaml           | 101 -------------------
 7 files changed, 116 insertions(+), 227 deletions(-)
 delete mode 100644 package.yaml

diff --git a/.gitignore b/.gitignore
index d607884..c89c92f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
 /cabal.*
-/dist/
+/dist*/
 /.*/
diff --git a/hikaru.cabal b/hikaru.cabal
index fd44085..39bd0ac 100644
--- a/hikaru.cabal
+++ b/hikaru.cabal
@@ -1,122 +1,112 @@
-cabal-version: 1.12
+cabal-version:      3.0
+name:               hikaru
+version:            0.1.0.0
+license:            AGPL-3.0-or-later
+license-file:       LICENSE.md
+copyright:          Jan Hamal Dvořák
+maintainer:         mordae@anilinux.org
+author:             Jan Hamal Dvořák
+homepage:           https://github.com/mordae/hikaru#readme
+bug-reports:        https://github.com/mordae/hikaru/issues
+synopsis:           Haskell web micro framework
+description:
+    Hikaru is a micro framework for web applications.
+    It provides applicative routing, content negotiation
+    and a customizable action monad.
+    .
+    (It is also a Star Trek reference, which is apparently
+    a requirement for this class of software.)
 
--- This file has been generated from package.yaml by hpack version 0.31.2.
---
--- see: https://github.com/sol/hpack
---
--- hash: 3bf5d3e31633e3ccf1a02683302849a23a53f7b621bf6e24759bdca47151b60a
-
-name:           hikaru
-version:        0.1.0.0
-synopsis:       Haskell web micro framework
-description:    Hikaru is a micro framework for web applications.
-                It provides applicative routing, content negotiation
-                and a customizable action monad.
-                .
-                (It is also a Star Trek reference, which is apparently
-                a requirement for this class of software.)
-category:       Web
-homepage:       https://github.com/mordae/hikaru#readme
-bug-reports:    https://github.com/mordae/hikaru/issues
-author:         Jan Hamal Dvořák
-maintainer:     mordae@anilinux.org
-copyright:      Jan Hamal Dvořák
-license:        AGPL-3
-license-file:   LICENSE.md
-build-type:     Simple
-extra-source-files:
-    README.md
+category:           Web
+build-type:         Simple
+extra-source-files: README.md
 
 source-repository head
-  type: git
-  location: https://github.com/mordae/hikaru
+    type:     git
+    location: https://github.com/mordae/hikaru
 
 library
-  exposed-modules:
-      Hikaru
-      Hikaru.Action
-      Hikaru.Config
-      Hikaru.CSRF
-      Hikaru.Dispatch
-      Hikaru.Form
-      Hikaru.Link
-      Hikaru.Localize
-      Hikaru.Media
-      Hikaru.Route
-      Hikaru.Types
-  other-modules:
-      Hikaru.Develop
-      Paths_hikaru
-  hs-source-dirs:
-      lib
-  default-extensions: BlockArguments DataKinds DefaultSignatures DeriveGeneric FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns NoImplicitPrelude OverloadedStrings RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving UndecidableInstances
-  ghc-options: -Wall -Wcompat
-  build-depends:
-      aeson >=1.4 && <1.5
-    , base >=4.13 && <4.14
-    , binary >=0.8 && <0.9
-    , bytestring >=0.10 && <0.11
-    , case-insensitive >=1.2 && <1.3
-    , containers >=0.6 && <0.7
-    , cookie >=0.4 && <0.5
-    , cryptonite >=0.26 && <0.27
-    , foreign-store >=0.2 && <0.3
-    , http-types >=0.12 && <0.13
-    , lucid >=2.9 && <2.10
-    , memory >=0.15 && <0.16
-    , mtl >=2.2 && <2.3
-    , relude >=0.7 && <0.8
-    , resourcet >=1.2 && <1.3
-    , string-conversions >=0.4 && <0.5
-    , text >=1.2 && <1.3
-    , text-icu >=0.7 && <0.8
-    , time >=1.9 && <1.10
-    , wai >=3.2 && <3.3
-    , wai-extra >=3.0 && <3.1
-    , wai-websockets >=3.0 && <3.1
-    , websockets >=0.12 && <0.13
-  default-language: Haskell2010
+    exposed-modules:
+        Hikaru
+        Hikaru.Action
+        Hikaru.Config
+        Hikaru.CSRF
+        Hikaru.Dispatch
+        Hikaru.Form
+        Hikaru.Link
+        Hikaru.Localize
+        Hikaru.Media
+        Hikaru.Route
+        Hikaru.Types
+
+    hs-source-dirs:     lib
+    other-modules:
+        Hikaru.Develop
+        Paths_hikaru
+
+    default-extensions:
+        BlockArguments DataKinds DefaultSignatures DeriveGeneric
+        FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving
+        KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns
+        NoImplicitPrelude OverloadedStrings RankNTypes RecordWildCards
+        ScopedTypeVariables StandaloneDeriving UndecidableInstances
+        EmptyDataDecls ImportQualifiedPost
+
+    ghc-options:
+        -Wall -Wcompat -Wincomplete-uni-patterns
+        -Wincomplete-record-updates -Widentities -Wredundant-constraints
+
+    build-depends:
+        aeson >=1.4 && <=1.6,
+        base >=4.13 && <=4.16,
+        binary >=0.8 && <=0.9,
+        bytestring >=0.10 && <=0.12,
+        case-insensitive >=1.2 && <=1.3,
+        containers >=0.6 && <=0.7,
+        cookie >=0.4 && <=0.5,
+        cryptonite >=0.26 && <=0.29,
+        foreign-store >=0.2 && <=0.3,
+        http-types >=0.12 && <=0.13,
+        lucid >=2.9 && <=2.10,
+        memory >=0.15 && <=0.16,
+        mtl >=2.2 && <=2.3,
+        relude >=0.7 && <=1.1,
+        resourcet >=1.2 && <=1.3,
+        string-conversions >=0.4 && <=0.5,
+        text >=1.2 && <=1.3,
+        text-icu >=0.7 && <=0.8,
+        time >=1.9 && <=1.12,
+        wai >=3.2 && <=3.3,
+        wai-extra >=3.0 && <=3.2,
+        wai-websockets >=3.0 && <=3.1,
+        websockets >=0.12 && <=0.13
 
 test-suite spec
-  type: exitcode-stdio-1.0
-  main-is: Spec.hs
-  other-modules:
-      Hikaru.Demo
-      Hikaru.DemoSpec
-      Hikaru.FormSpec
-      Hikaru.Test
-      Paths_hikaru
-  hs-source-dirs:
-      test
-  default-extensions: BlockArguments DataKinds DefaultSignatures DeriveGeneric FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns NoImplicitPrelude OverloadedStrings RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving UndecidableInstances
-  ghc-options: -Wall -Wcompat -threaded -rtsopts -with-rtsopts=-N
-  cpp-options: -DTEST
-  build-tool-depends:
-      hspec-discover:hspec-discover
-  build-depends:
-      aeson >=1.4 && <1.5
-    , base >=4.13 && <4.14
-    , binary >=0.8 && <0.9
-    , bytestring >=0.10 && <0.11
-    , case-insensitive >=1.2 && <1.3
-    , containers >=0.6 && <0.7
-    , cookie >=0.4 && <0.5
-    , cryptonite >=0.26 && <0.27
-    , foreign-store >=0.2 && <0.3
-    , hikaru
-    , hspec
-    , http-types >=0.12 && <0.13
-    , lucid >=2.9 && <2.10
-    , memory >=0.15 && <0.16
-    , mtl >=2.2 && <2.3
-    , relude >=0.7 && <0.8
-    , resourcet >=1.2 && <1.3
-    , string-conversions >=0.4 && <0.5
-    , text >=1.2 && <1.3
-    , text-icu >=0.7 && <0.8
-    , time >=1.9 && <1.10
-    , wai >=3.2 && <3.3
-    , wai-extra >=3.0 && <3.1
-    , wai-websockets >=3.0 && <3.1
-    , websockets >=0.12 && <0.13
-  default-language: Haskell2010
+    type:               exitcode-stdio-1.0
+    main-is:            Spec.hs
+    build-tool-depends: hspec-discover:hspec-discover -any
+    cpp-options:        -DTEST
+    hs-source-dirs:     test
+    other-modules:
+        Hikaru.Demo
+        Hikaru.DemoSpec
+        Hikaru.FormSpec
+        Hikaru.Test
+        Paths_hikaru
+
+    default-extensions:
+        BlockArguments DataKinds DefaultSignatures DeriveGeneric
+        FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving
+        KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns
+        NoImplicitPrelude OverloadedStrings RankNTypes RecordWildCards
+        ScopedTypeVariables StandaloneDeriving UndecidableInstances
+        EmptyDataDecls ImportQualifiedPost
+
+    ghc-options:
+        -Wall -Wcompat -Wincomplete-uni-patterns
+        -Wincomplete-record-updates -Widentities -Wredundant-constraints
+        -threaded -rtsopts -with-rtsopts=-N
+
+    build-depends:
+        hikaru -any,
+        hspec -any
diff --git a/lib/Hikaru/Action.hs b/lib/Hikaru/Action.hs
index 8fbf2db..3e496cb 100644
--- a/lib/Hikaru/Action.hs
+++ b/lib/Hikaru/Action.hs
@@ -126,7 +126,7 @@ where
   import Data.Aeson (Value, ToJSON, encode, eitherDecode')
   import Data.Binary.Builder
   import Data.Dynamic
-  import Data.List
+  import Data.List (lookup, deleteBy)
   import Data.String.Conversions
   import Hikaru.Config
   import Hikaru.Media
diff --git a/lib/Hikaru/Config.hs b/lib/Hikaru/Config.hs
index e7c5777..8131f18 100644
--- a/lib/Hikaru/Config.hs
+++ b/lib/Hikaru/Config.hs
@@ -34,7 +34,7 @@ module Hikaru.Config
   , generateSecret
   )
 where
-  import Relude hiding (drop, lines, isPrefixOf, length)
+  import Relude hiding (drop, lines, isPrefixOf, length, span)
 
   import qualified Data.Map as Map
 
diff --git a/lib/Hikaru/Form.hs b/lib/Hikaru/Form.hs
index 662c413..713764c 100644
--- a/lib/Hikaru/Form.hs
+++ b/lib/Hikaru/Form.hs
@@ -99,7 +99,7 @@ where
   import Relude hiding (Option, show, elem)
 
   import Data.Dynamic
-  import Data.List
+  import Data.List (elem, lookup)
   import Data.Text (strip)
   import Hikaru.Action
   import Hikaru.CSRF
@@ -608,7 +608,7 @@ where
               -> ControlT 'InputFieldTag l o v m a
               -> FormT l o m v
   hiddenValue name generate body = FormT do
-    env@Env{..} <- ask
+    env <- ask
     (val, text) <- getParamOrig name generate
 
     new <- lift $ lift do
@@ -689,7 +689,7 @@ where
   -- |
   -- TODO
   --
-  select :: (Monad m, FromFormMessage l, Param v, Selectable v)
+  select :: (Monad m, FromFormMessage l, Selectable v)
          => Text
          -> (o -> v)
          -> ControlT 'SelectFieldTag l o v m a
@@ -717,7 +717,7 @@ where
   --
   -- TODO: Add an example.
   --
-  options :: (Monad m, Param v, Selectable v)
+  options :: (Monad m, Selectable v)
           => [Option l] -> ControlT 'SelectFieldTag l o v m ()
   options opts = ControlT do
     modify \s@ControlState{..} ->
@@ -800,7 +800,7 @@ where
   -- Debugging ---------------------------------------------------------------
 
 
-  dumpForm :: (MonadIO m, Show l, Show o) => FormT l o m ()
+  dumpForm :: (MonadIO m, Show o) => FormT l o m ()
   dumpForm = FormT do
     env <- ask
 
@@ -811,7 +811,7 @@ where
     return $ Just ()
 
 
-  dumpControl :: (MonadIO m, Show l, Show o, Show v) => ControlT t l o v m ()
+  dumpControl :: (MonadIO m, Show l, Show v) => ControlT t l o v m ()
   dumpControl = ControlT do
     ctrst <- get
 
@@ -838,7 +838,7 @@ where
          in return (fromParam =<< param, fromMaybe "" param)
 
 
-  getSelectParams :: (Monad m, Param v, Selectable v)
+  getSelectParams :: (Monad m, Selectable v)
                   => Text -> ReaderT (Env o) m (Maybe v)
   getSelectParams name = do
     Env{..} <- ask
diff --git a/lib/Hikaru/Localize.hs b/lib/Hikaru/Localize.hs
index 1882e82..3714383 100644
--- a/lib/Hikaru/Localize.hs
+++ b/lib/Hikaru/Localize.hs
@@ -66,7 +66,7 @@ module Hikaru.Localize
 where
   import Relude
 
-  import Data.List
+  import Data.List (nub)
   import Data.String.Conversions
   import Hikaru.Action
   import Hikaru.Media
diff --git a/package.yaml b/package.yaml
deleted file mode 100644
index 8485bdd..0000000
--- a/package.yaml
+++ /dev/null
@@ -1,101 +0,0 @@
-name: hikaru
-version: 0.1.0.0
-synopsis: Haskell web micro framework
-category: Web
-description: |
-  Hikaru is a micro framework for web applications.
-  It provides applicative routing, content negotiation
-  and a customizable action monad.
-
-  (It is also a Star Trek reference, which is apparently
-  a requirement for this class of software.)
-
-author: Jan Hamal Dvořák
-github: mordae/hikaru
-maintainer: mordae@anilinux.org
-
-copyright: Jan Hamal Dvořák
-license-file: LICENSE.md
-license: AGPL-3
-
-build-type: Simple
-extra-source-files: README.md
-
-ghc-options: -Wall -Wcompat
-default-extensions:
-  - BlockArguments
-  - DataKinds
-  - DefaultSignatures
-  - DeriveGeneric
-  - FlexibleContexts
-  - FlexibleInstances
-  - GADTs
-  - GeneralizedNewtypeDeriving
-  - KindSignatures
-  - LambdaCase
-  - MultiParamTypeClasses
-  - NamedFieldPuns
-  - NoImplicitPrelude
-  - OverloadedStrings
-  - RankNTypes
-  - RecordWildCards
-  - ScopedTypeVariables
-  - StandaloneDeriving
-  - UndecidableInstances
-
-dependencies:
-  - aeson              >= 1.4   && <1.5
-  - base               >= 4.13  && <4.14
-  - binary             >= 0.8   && <0.9
-  - bytestring         >= 0.10  && <0.11
-  - case-insensitive   >= 1.2   && <1.3
-  - containers         >= 0.6   && <0.7
-  - cookie             >= 0.4   && <0.5
-  - cryptonite         >= 0.26  && <0.27
-  - foreign-store      >= 0.2   && <0.3
-  - http-types         >= 0.12  && <0.13
-  - lucid              >= 2.9   && <2.10
-  - memory             >= 0.15  && <0.16
-  - mtl                >= 2.2   && <2.3
-  - relude             >= 0.7   && <0.8
-  - resourcet          >= 1.2   && <1.3
-  - string-conversions >= 0.4   && <0.5
-  - text               >= 1.2   && <1.3
-  - text-icu           >= 0.7   && <0.8
-  - time               >= 1.9   && <1.10
-  - wai                >= 3.2   && <3.3
-  - wai-extra          >= 3.0   && <3.1
-  - wai-websockets     >= 3.0   && <3.1
-  - websockets         >= 0.12  && <0.13
-
-library:
-  source-dirs: lib
-  dependencies: []
-
-  exposed-modules:
-    - Hikaru
-    - Hikaru.Action
-    - Hikaru.Config
-    - Hikaru.CSRF
-    - Hikaru.Dispatch
-    - Hikaru.Form
-    - Hikaru.Link
-    - Hikaru.Localize
-    - Hikaru.Media
-    - Hikaru.Route
-    - Hikaru.Types
-
-tests:
-  spec:
-    main: Spec.hs
-    source-dirs: test
-    ghc-options: -threaded -rtsopts -with-rtsopts=-N
-    cpp-options: -DTEST
-
-    dependencies:
-      - hikaru
-      - hspec
-
-    build-tools: hspec-discover
-
-# EOF
-- 
GitLab