Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GHC >= 9.6 #9

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## 1.4

* Support GHC >= 9.6
* Use `buildVariantExtractor` in `Codec.Winery.Query.con`
* Require mtl >= 2.3

## 1.4

* Added an instance for `NonEmpty`
* Removed the instance for `Option`
* Added `withSchema`
Expand Down
8 changes: 6 additions & 2 deletions src/Codec/Winery/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ import Barbies.Constraints
import Barbies.TH
import Control.Applicative
import Control.Exception
import Control.Monad.Reader
import Control.Monad
import Control.Monad.Fix
import qualified Data.ByteString as B
import qualified Data.ByteString.FastBuilder as BB
import qualified Data.ByteString.Lazy as BL
Expand Down Expand Up @@ -117,6 +118,9 @@ import GHC.Float (castWord32ToFloat, castWord64ToDouble)
import GHC.Natural
import GHC.Generics
import GHC.TypeLits
#if __GLASGOW_HASKELL__ >= 906
hiding (SChar)
#endif

-- | Serialisable datatype
--
Expand Down Expand Up @@ -1104,4 +1108,4 @@ buildRecordExtractor = buildExtractor . btraverse (fmap Identity)
-- | Collect extractors for record fields
bextractors :: forall b. (ConstraintsB b, AllB Serialise b, FieldNamesB b) => b Subextractor
bextractors = bmapC @Serialise (extractField . getConst) bfieldNames
{-# INLINABLE bextractors #-}
{-# INLINABLE bextractors #-}
3 changes: 2 additions & 1 deletion src/Codec/Winery/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Codec.Winery.Internal
import Data.Typeable
import qualified Data.Text as T
import qualified Data.Vector as V
import qualified Data.HashMap.Strict as HM

-- | Query is a transformation between 'Extractor's.
-- Like jq, this returns a list of values.
Expand Down Expand Up @@ -71,7 +72,7 @@ field name = Query $ \d -> buildExtractor $ extractFieldBy d name

-- | Takes a variant and returns a value when the constructor matches.
con :: Typeable a => T.Text -> Query a a
con name = Query $ \d -> buildExtractor $ extractConstructorBy (d, name, id) (pure [])
con name = Query $ \d -> buildVariantExtractor $ HM.singleton name d

-- | Propagate values if the supplied 'Query' doesn't return False.
select :: Query a Bool -> Query a a
Expand Down
4 changes: 2 additions & 2 deletions winery.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.0
name: winery
version: 1.4
version: 1.5
synopsis: A compact, well-typed seralisation format for Haskell values
description:
<<https://i.imgur.com/lTosHnE.png>>
Expand Down Expand Up @@ -50,7 +50,7 @@ library
, hashable
, HUnit
, megaparsec >=7.0.0
, mtl
, mtl >= 2.3
, prettyprinter ^>= 1.7
, prettyprinter-ansi-terminal
, scientific
Expand Down
Loading