|
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 #-} |
@@ -130,6 +132,7 @@ import Data.Either.Validation |
130 | 132 | , eitherToValidation |
131 | 133 | , validationToEither |
132 | 134 | ) |
| 135 | +import Data.Functor.Contravariant (Op(..), Predicate(..), Equivalence(..)) |
133 | 136 | import Data.Hashable (Hashable) |
134 | 137 | import Data.Int (Int16, Int32, Int64, Int8) |
135 | 138 | import Data.List.NonEmpty (NonEmpty (..)) |
@@ -338,6 +341,12 @@ instance FromDhall (f (Result f)) => FromDhall (Result f) where |
338 | 341 |
|
339 | 342 | expected = pure "result" |
340 | 343 |
|
| 344 | +deriving newtype instance (ToDhall x) => FromDhall (Predicate x) |
| 345 | + |
| 346 | +deriving newtype instance (ToDhall x) => FromDhall (Equivalence x) |
| 347 | + |
| 348 | +deriving newtype instance (FromDhall b, ToDhall x) => FromDhall (Op b x) |
| 349 | + |
341 | 350 | -- | You can use this instance to marshal recursive types from Dhall to Haskell. |
342 | 351 | -- |
343 | 352 | -- Here is an example use of this instance: |
|
0 commit comments