Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
Manually provide 'Distribute' instances
Browse files Browse the repository at this point in the history
For some reason, GHC >= 7.8 can not derive these

See #263
  • Loading branch information
hanshoglund committed Jul 18, 2014
1 parent 1b04ef5 commit fbb4734
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Music/Time/Behavior.hs
Expand Up @@ -143,7 +143,8 @@ newtype Behavior a = Behavior { getBehavior :: Time -> a }
instance Show (Behavior a) where
show _ = "<<Behavior>>"

deriving instance Distributive Behavior
instance Distributive Behavior where
distribute = Behavior . distribute . fmap getBehavior

instance Transformable (Behavior a) where
transform s (Behavior a) = Behavior (a `whilst` s)
Expand Down
6 changes: 3 additions & 3 deletions src/Music/Time/Segment.hs
Expand Up @@ -125,7 +125,7 @@ import Music.Pitch.Literal
-- To place a segment in a particular time span, use 'Note' 'Segment'.
--
newtype Segment a = Segment { getSegment :: Clipped Duration -> a }
deriving (Functor, Applicative, Monad{-, Comonad-})
deriving (Functor, Applicative, Monad{-, Comonad-}, Typeable)

-- $semantics Segment
--
Expand All @@ -144,8 +144,8 @@ newtype Segment a = Segment { getSegment :: Clipped Duration -> a }
instance Show (Segment a) where
show _ = "<<Segment>>"

deriving instance Typeable1 Segment
deriving instance Distributive Segment
instance Distributive Segment where
distribute = Segment . distribute . fmap getSegment

instance Representable Segment where
type Rep Segment = Duration
Expand Down

0 comments on commit fbb4734

Please sign in to comment.