about summary refs log tree commit diff
path: root/users/Profpatsch/netencode
diff options
context:
space:
mode:
Diffstat (limited to 'users/Profpatsch/netencode')
-rw-r--r--users/Profpatsch/netencode/Netencode.hs18
-rw-r--r--users/Profpatsch/netencode/Netencode/Parse.hs13
-rw-r--r--users/Profpatsch/netencode/default.nix4
-rw-r--r--users/Profpatsch/netencode/netencode.cabal57
4 files changed, 61 insertions, 31 deletions
diff --git a/users/Profpatsch/netencode/Netencode.hs b/users/Profpatsch/netencode/Netencode.hs
index 36d3907ffc0a..ca93ab2fefdf 100644
--- a/users/Profpatsch/netencode/Netencode.hs
+++ b/users/Profpatsch/netencode/Netencode.hs
@@ -1,15 +1,6 @@
 {-# LANGUAGE AllowAmbiguousTypes #-}
-{-# LANGUAGE DeriveFunctor #-}
-{-# LANGUAGE DerivingStrategies #-}
-{-# LANGUAGE GHC2021 #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE QuasiQuotes #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeApplications #-}
 
 module Netencode where
 
@@ -20,15 +11,12 @@ import Data.ByteString qualified as ByteString
 import Data.ByteString.Builder (Builder)
 import Data.ByteString.Builder qualified as Builder
 import Data.ByteString.Lazy qualified as ByteString.Lazy
-import Data.Coerce (coerce)
 import Data.Fix (Fix (Fix))
 import Data.Fix qualified as Fix
 import Data.Functor.Classes (Eq1 (liftEq))
 import Data.Int (Int16, Int32, Int64, Int8)
-import Data.List.NonEmpty (nonEmpty)
 import Data.Map.NonEmpty (NEMap)
 import Data.Map.NonEmpty qualified as NEMap
-import Data.Maybe (fromMaybe)
 import Data.Semigroup qualified as Semi
 import Data.String (IsString)
 import Data.Word (Word16, Word32, Word64)
@@ -36,7 +24,7 @@ import GHC.Exts (fromString)
 import Hedgehog qualified as Hedge
 import Hedgehog.Gen qualified as Gen
 import Hedgehog.Range qualified as Range
-import MyPrelude
+import PossehlAnalyticsPrelude
 import Text.Show.Deriving
 import Prelude hiding (sum)
 
@@ -74,7 +62,7 @@ instance Eq1 TF where
   liftEq _ (I6 i64) (I6 i64') = i64 == i64'
   liftEq _ (Text t) (Text t') = t == t'
   liftEq _ (Bytes b) (Bytes b') = b == b'
-  liftEq eq (Sum t) (Sum t') = eq (t & tagVal) (t' & tagVal)
+  liftEq eq (Sum t) (Sum t') = eq (t.tagVal) (t'.tagVal)
   liftEq eq (Record m) (Record m') = liftEq eq m m'
   liftEq eq (List xs) (List xs') = liftEq eq xs xs'
   liftEq _ _ _ = False
@@ -292,7 +280,7 @@ netencodeParserF inner = do
           Just tags ->
             pure $
               tags
-                <&> (\t -> (t & tagTag, t & tagVal))
+                <&> (\t -> (t.tagTag, t.tagVal))
                 -- later keys are preferred if they are duplicates, according to the standard
                 & NEMap.fromList
       _ <- Atto.Char.char '}' Atto.<?> "record did not end with }"
diff --git a/users/Profpatsch/netencode/Netencode/Parse.hs b/users/Profpatsch/netencode/Netencode/Parse.hs
index de313571f713..adfd1e0a6534 100644
--- a/users/Profpatsch/netencode/Netencode/Parse.hs
+++ b/users/Profpatsch/netencode/Netencode/Parse.hs
@@ -1,14 +1,4 @@
-{-# LANGUAGE ApplicativeDo #-}
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DerivingVia #-}
-{-# LANGUAGE GHC2021 #-}
-{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE OverloadedRecordDot #-}
-{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE QuasiQuotes #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE NoFieldSelectors #-}
-{-# OPTIONS_GHC -Wall #-}
 
 module Netencode.Parse where
 
@@ -23,8 +13,9 @@ import Data.Map.NonEmpty qualified as NEMap
 import Data.Semigroupoid qualified as Semigroupiod
 import Data.Semigroupoid qualified as Semigroupoid
 import Data.Text qualified as Text
-import MyPrelude
+import Label
 import Netencode qualified
+import PossehlAnalyticsPrelude
 import Prelude hiding (log)
 
 newtype Parse from to
diff --git a/users/Profpatsch/netencode/default.nix b/users/Profpatsch/netencode/default.nix
index cb3dfaee4529..6e7dce489a81 100644
--- a/users/Profpatsch/netencode/default.nix
+++ b/users/Profpatsch/netencode/default.nix
@@ -28,7 +28,9 @@ let
       pkgs.haskellPackages.data-fix
       pkgs.haskellPackages.bytestring
       pkgs.haskellPackages.attoparsec
-      depot.users.Profpatsch.my-prelude
+      pkgs.haskellPackages.pa-prelude
+      pkgs.haskellPackages.pa-label
+      pkgs.haskellPackages.pa-error-tree
     ];
 
     isLibrary = true;
diff --git a/users/Profpatsch/netencode/netencode.cabal b/users/Profpatsch/netencode/netencode.cabal
index 4e418d6dd887..7bff4487bbc1 100644
--- a/users/Profpatsch/netencode/netencode.cabal
+++ b/users/Profpatsch/netencode/netencode.cabal
@@ -1,25 +1,74 @@
-cabal-version:      2.4
+cabal-version:      3.0
 name:               netencode
 version:            0.1.0.0
 author:             Profpatsch
 maintainer:         mail@profpatsch.de
 
+
+common common-options
+  ghc-options:
+      -Wall
+      -Wno-type-defaults
+      -Wunused-packages
+      -Wredundant-constraints
+      -fwarn-missing-deriving-strategies
+
+  -- See https://downloads.haskell.org/ghc/latest/docs/users_guide/exts.html
+  -- for a description of all these extensions
+  default-extensions:
+      -- Infer Applicative instead of Monad where possible
+    ApplicativeDo
+
+    -- Allow literal strings to be Text
+    OverloadedStrings
+
+    -- Syntactic sugar improvements
+    LambdaCase
+    MultiWayIf
+
+    -- Makes the (deprecated) usage of * instead of Data.Kind.Type an error
+    NoStarIsType
+
+    -- Convenient and crucial to deal with ambiguous field names, commonly
+    -- known as RecordDotSyntax
+    OverloadedRecordDot
+
+    -- does not export record fields as functions, use OverloadedRecordDot to access instead
+    NoFieldSelectors
+
+    -- Record punning
+    RecordWildCards
+
+    -- Improved Deriving
+    DerivingStrategies
+    DerivingVia
+
+    -- Type-level strings
+    DataKinds
+
+    -- to enable the `type` keyword in import lists (ormolu uses this automatically)
+    ExplicitNamespaces
+
+  default-language: GHC2021
+
+
 library
+    import: common-options
     exposed-modules:
         Netencode,
         Netencode.Parse
 
     build-depends:
         base >=4.15 && <5,
+        pa-prelude,
+        pa-label,
+        pa-error-tree,
         hedgehog,
         nonempty-containers,
         deriving-compat,
-        my-prelude,
         data-fix,
         bytestring,
         attoparsec,
         text,
         semigroupoids,
         selective
-
-    default-language: Haskell2010