Skip to content

Commit

Permalink
Fix build with recursion-schemes >= 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Sep 16, 2020
1 parent 13f44ad commit 3f902be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions binary/cardano-binary.cabal
Expand Up @@ -41,6 +41,7 @@ library
, cardano-prelude
, cborg >= 0.2.2 && < 0.3
, containers
, data-fix
, digest
, formatting
, primitive
Expand Down
10 changes: 8 additions & 2 deletions binary/src/Cardano/Binary/ToCBOR.hs
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstrainedClassMethods #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE ExistentialQuantification #-}
Expand Down Expand Up @@ -44,7 +45,12 @@ import qualified Data.ByteString.Short as SBS
import qualified Data.ByteString.Short.Internal as SBS
import qualified Data.Primitive.ByteArray as Prim
import Data.Fixed (E12, Fixed(..), Nano, Pico, resolution)
import Data.Functor.Foldable (Fix(..), cata, unfix)
#if MIN_VERSION_recursion_schemes(5,2,0)
import Data.Fix ( Fix(..) )
#else
import Data.Functor.Foldable (Fix(..))
#endif
import Data.Functor.Foldable (cata, project)
import qualified Data.Map as M
import qualified Data.Set as S
import Data.Tagged (Tagged(..))
Expand Down Expand Up @@ -166,7 +172,7 @@ instance B.Buildable t => B.Buildable (SizeF t) where
TodoF _ x -> bprint ("(_ :: " . shown . ")") (typeRep x)

instance B.Buildable (Fix SizeF) where
build x = bprint build (unfix x)
build x = bprint build (project @(Fix _) x)

-- | Create a case expression from individual cases.
szCases :: [Case Size] -> Size
Expand Down

0 comments on commit 3f902be

Please sign in to comment.