Skip to content

Commit

Permalink
setTactus to take Maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Jan 16, 2025
1 parent 97e09bc commit 1cad7bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Sound/Tidal/Pattern.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ instance NFData a => NFData (Pattern a)
pattern :: (State -> [Event a]) -> Pattern a
pattern f = Pattern f Nothing Nothing

setTactus :: Pattern Rational -> Pattern a -> Pattern a
setTactus r p = p {tactus = Just $ r}
setTactus :: Maybe (Pattern Rational) -> Pattern a -> Pattern a
setTactus r p = p {tactus = r}

setTactusFrom :: Pattern b -> Pattern a -> Pattern a
setTactusFrom a b = b {tactus = tactus a}
Expand All @@ -72,7 +72,7 @@ withTactus :: (Rational -> Rational) -> Pattern a -> Pattern a
withTactus f p = p {tactus = fmap (fmap f) $ tactus p}

steps :: Pattern Rational -> Pattern a -> Pattern a
steps target p@(Pattern _ (Just t) _) = setTactus target $ fast (target / t) p
steps target p@(Pattern _ (Just t) _) = setTactus (Just target) $ fast (target / t) p
-- raise error?
steps _ p = p

Expand Down

0 comments on commit 1cad7bc

Please sign in to comment.