chore(users/Profpatsch/*): more cabal maintenance
Change-Id: Ib1714abce2815873eb50dbeac088e812fa9098ab Reviewed-on: https://cl.tvl.fyi/c/depot/+/8686 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de> Autosubmit: Profpatsch <mail@profpatsch.de>
This commit is contained in:
parent
ee21f725a3
commit
8c4730c433
24 changed files with 264 additions and 203 deletions
|
|
@ -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 }"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue