Skip to content

Commit

Permalink
make <* and *> strict, a quick fix for #432
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Dec 16, 2018
1 parent 0eae69c commit 412002a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/Sound/Tidal/Pattern.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE DeriveDataTypeable, TypeSynonymInstances, FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

module Sound.Tidal.Pattern where
Expand Down Expand Up @@ -275,7 +276,7 @@ instance Applicative Pattern where

-- | Like <*>, but the structure only comes from the left
(<*) :: Pattern (a -> b) -> Pattern a -> Pattern b
(<*) pf@(Pattern Digital _) px = Pattern Digital q
(<*) !pf@(Pattern Digital _) !px = Pattern Digital q
where q st = concatMap match $ query pf st
where
match (Event fWhole fPart f) =
Expand All @@ -284,7 +285,7 @@ instance Applicative Pattern where
query px $ st {arc = xQuery fWhole}
xQuery (Arc s _) = pure s -- for discrete events, match with the onset

pf <* px = Pattern Analog q
(<*) !pf !px = Pattern Analog q
where q st = concatMap match $ query pf st
where
match (Event fWhole fPart f) =
Expand All @@ -294,7 +295,7 @@ pf <* px = Pattern Analog q

-- | Like <*>, but the structure only comes from the right
(*>) :: Pattern (a -> b) -> Pattern a -> Pattern b
(*>) pf px@(Pattern Digital _) = Pattern Digital q
(*>) !pf !px@(Pattern Digital _) = Pattern Digital q
where q st = concatMap match $ query px st
where
match (Event xWhole xPart x) =
Expand All @@ -303,7 +304,7 @@ pf <* px = Pattern Analog q
query pf $ fQuery xWhole
fQuery (Arc s _) = st {arc = pure s} -- for discrete events, match with the onset

pf *> px = Pattern Analog q
(*>) !pf !px = Pattern Analog q
where q st = concatMap match $ query px st
where
match (Event xWhole xPart x) =
Expand Down
2 changes: 1 addition & 1 deletion src/Sound/Tidal/Version.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

module Sound.Tidal.Version where

tidal_version = "1.0.0"
tidal_version = "1.0.1"
2 changes: 1 addition & 1 deletion tidal.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tidal
version: 1.0.0
version: 1.0.1
synopsis: Pattern language for improvised music
-- description:
homepage: http://tidalcycles.org/
Expand Down

0 comments on commit 412002a

Please sign in to comment.