Skip to content

Commit

Permalink
Merge pull request #9 from FinleyMcIlwaine/finley/support-9.6
Browse files Browse the repository at this point in the history
Support GHC >= 9.6
  • Loading branch information
fumieval authored Nov 18, 2024
2 parents 4778621 + 5f124ff commit 99a0195
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
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

0 comments on commit 99a0195

Please sign in to comment.