1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Define a Pretty1 instance for Free.

This commit is contained in:
Rob Rix 2017-08-22 12:53:19 -04:00
parent 2b278c1688
commit 68cc44f91b

View File

@ -8,6 +8,7 @@ import qualified Control.Monad.Free as Free
import qualified Control.Monad.Trans.Free as FreeF
import Data.Bifunctor
import Data.Functor.Both as Both
import Data.Functor.Classes.Pretty
import Data.Mergeable
import Data.Record
import Patch
@ -63,3 +64,8 @@ free (FreeF.Pure a) = Free.Pure a
runFree :: Free.Free f a -> FreeF.FreeF f a (Free.Free f a)
runFree (Free.Free f) = FreeF.Free f
runFree (Free.Pure a) = FreeF.Pure a
instance Pretty1 f => Pretty1 (Free.Free f) where
liftPretty p pl = go where go (Free.Pure a) = p a
go (Free.Free f) = liftPretty go (liftPrettyList p pl) f