2
2
{-# LANGUAGE ConstraintKinds #-}
3
3
{-# LANGUAGE DefaultSignatures #-}
4
4
{-# LANGUAGE DeriveFunctor #-}
5
+ {-# LANGUAGE DerivingStrategies #-}
5
6
{-# LANGUAGE FlexibleContexts #-}
6
7
{-# LANGUAGE FlexibleInstances #-}
7
8
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
12
13
{-# LANGUAGE RankNTypes #-}
13
14
{-# LANGUAGE RecordWildCards #-}
14
15
{-# LANGUAGE ScopedTypeVariables #-}
16
+ {-# LANGUAGE StandaloneDeriving #-}
15
17
{-# LANGUAGE TupleSections #-}
16
18
{-# LANGUAGE TypeApplications #-}
17
19
{-# LANGUAGE TypeFamilies #-}
@@ -117,6 +119,9 @@ module Dhall.Marshal.Decode
117
119
, Text
118
120
, Vector
119
121
, Generic
122
+ , Op
123
+ , Predicate
124
+ , Equivalence
120
125
) where
121
126
122
127
@@ -130,6 +135,7 @@ import Data.Either.Validation
130
135
, eitherToValidation
131
136
, validationToEither
132
137
)
138
+ import Data.Functor.Contravariant (Op (.. ), Predicate (.. ), Equivalence (.. ))
133
139
import Data.Hashable (Hashable )
134
140
import Data.Int (Int16 , Int32 , Int64 , Int8 )
135
141
import Data.List.NonEmpty (NonEmpty (.. ))
@@ -338,6 +344,12 @@ instance FromDhall (f (Result f)) => FromDhall (Result f) where
338
344
339
345
expected = pure " result"
340
346
347
+ deriving newtype instance (ToDhall x ) => FromDhall (Predicate x )
348
+
349
+ deriving newtype instance (ToDhall x ) => FromDhall (Equivalence x )
350
+
351
+ deriving newtype instance (FromDhall b , ToDhall x ) => FromDhall (Op b x )
352
+
341
353
-- | You can use this instance to marshal recursive types from Dhall to Haskell.
342
354
--
343
355
-- Here is an example use of this instance:
0 commit comments