We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It spins endlessly and produces an infinite string of repeating "CofreeT (". It's a one line fix but I added a test for it anyway:
diff --git a/free.cabal b/free.cabal index 86df40e..30ff931 100644 --- a/free.cabal +++ b/free.cabal @@ -95,3 +95,12 @@ library Control.Monad.Trans.Iter ghc-options: -Wall + +test-suite CofreeTShowRead + hs-source-dirs: test/ + default-language: Haskell2010 + type: exitcode-stdio-1.0 + main-is: CofreeTShowRead.hs + build-depends: + base == 4.*, + free diff --git a/src/Control/Comonad/Trans/Cofree.hs b/src/Control/Comonad/Trans/Cofree.hs index bdf8ce7..20e6ad3 100644 --- a/src/Control/Comonad/Trans/Cofree.hs +++ b/src/Control/Comonad/Trans/Cofree.hs @@ -139,7 +139,7 @@ instance (Functor f, Comonad w) => ComonadCofree f (CofreeT f w) where unwrap = tailF . extract . runCofreeT instance Show (w (CofreeF f a (CofreeT f w a))) => Show (CofreeT f w a) where - showsPrec d w = showParen (d > 10) $ + showsPrec d (CofreeT w) = showParen (d > 10) $ showString "CofreeT " . showsPrec 11 w instance Read (w (CofreeF f a (CofreeT f w a))) => Read (CofreeT f w a) where diff --git a/test/CofreeTShowRead.hs b/test/CofreeTShowRead.hs new file mode 100644 index 0000000..dc471b7 --- /dev/null +++ b/test/CofreeTShowRead.hs @@ -0,0 +1,10 @@ +import Control.Comonad.Trans.Cofree +import Control.Monad +import System.Exit + +main = do + let x :: CofreeT Maybe [] Bool + x = CofreeT [True :< Nothing] + x' :: CofreeT Maybe [] Bool + x' = read . show $ x + when (x /= x') exitFailure
The text was updated successfully, but these errors were encountered:
ed0d1d3
No branches or pull requests
It spins endlessly and produces an infinite string of repeating "CofreeT (". It's a one line fix but I added a test for it anyway:
The text was updated successfully, but these errors were encountered: