refactor: reimplement Tagged, drop dependency

This commit is contained in:
Maksym Ivanov 2023-11-03 11:51:57 +01:00
parent 5af68c7a89
commit 335e19ed1b
No known key found for this signature in database
4 changed files with 7 additions and 3 deletions

View File

@ -64,7 +64,6 @@ library
random >=1.2.1 && <1.3, random >=1.2.1 && <1.3,
regex-tdfa >=1.3.1 && <1.4, regex-tdfa >=1.3.1 && <1.4,
stm >=2.5.0 && <2.6, stm >=2.5.0 && <2.6,
tagged >= 0.1.0 && <1.0,
tar >=0.5.1 && <0.6, tar >=0.5.1 && <0.6,
template-haskell >=2.17.0 && <3.0, template-haskell >=2.17.0 && <3.0,
text >=1.2.5 && <3.0, text >=1.2.5 && <3.0,

View File

@ -1,4 +1,6 @@
{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
@ -114,3 +116,8 @@ instance FromJSON SSLConfig where
return $ SSL cert chainCerts key return $ SSL cert chainCerts key
_ -> return SSLFalse -- fail "Must provide both certificate and key files" _ -> return SSLFalse -- fail "Must provide both certificate and key files"
) v ) v
-- | A helper to attach arbitrary "phantom type" to a value type.
-- Reimplemented minimally from the `tagged` package to avoid a dependency.
newtype Tagged (phantomtag :: anykind) a = Tagged { untag :: a }
deriving Functor

View File

@ -21,7 +21,6 @@ import Data.Maybe (catMaybes, fromMaybe, isJust
import Data.Proxy (Proxy(Proxy)) import Data.Proxy (Proxy(Proxy))
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.String (fromString) import Data.String (fromString)
import Data.Tagged
import Data.Vector (Vector) import Data.Vector (Vector)
import qualified Data.Vector as V import qualified Data.Vector as V
import Data.Word (Word) import Data.Word (Word)

View File

@ -29,7 +29,6 @@ import Network.Wai.Middleware.Gzip (def)
#endif #endif
import Data.Monoid (mappend, mempty) import Data.Monoid (mappend, mempty)
import Data.Proxy import Data.Proxy
import Data.Tagged
import Data.Text as T (pack, unwords) import Data.Text as T (pack, unwords)
import Data.Text.Encoding (decodeUtf8With, encodeUtf8) import Data.Text.Encoding (decodeUtf8With, encodeUtf8)
import Data.Text.Encoding.Error (lenientDecode) import Data.Text.Encoding.Error (lenientDecode)