Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit c6ef650

Browse files
committed
Revert "Apply stylish-haskell formatting"
This reverts commit 491bd1b, reversing changes made to 9eca1d6.
1 parent 491bd1b commit c6ef650

File tree

3 files changed

+86
-92
lines changed

3 files changed

+86
-92
lines changed

src/Sound/Tidal/Stream/Process.hs

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{-# LANGUAGE BangPatterns #-}
2-
{-# LANGUAGE ConstraintKinds #-}
3-
{-# LANGUAGE FlexibleContexts #-}
4-
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5-
{-# LANGUAGE ScopedTypeVariables #-}
1+
{-# LANGUAGE ConstraintKinds, GeneralizedNewtypeDeriving, FlexibleContexts, ScopedTypeVariables, BangPatterns #-}
62
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
7-
{-# LANGUAGE DeriveGeneric #-}
8-
{-# LANGUAGE StandaloneDeriving #-}
3+
{-# language DeriveGeneric, StandaloneDeriving #-}
94

105
module Sound.Tidal.Stream.Process where
116

@@ -27,43 +22,43 @@ module Sound.Tidal.Stream.Process where
2722
along with this library. If not, see <http://www.gnu.org/licenses/>.
2823
-}
2924

30-
import Control.Applicative ((<|>))
25+
import Control.Applicative ((<|>))
3126
import Control.Concurrent.MVar
32-
import qualified Control.Exception as E
33-
import Control.Monad (forM_, when)
34-
import Data.Coerce (coerce)
35-
import qualified Data.Map.Strict as Map
36-
import Data.Maybe (catMaybes, fromJust, fromMaybe)
27+
import Control.Monad (forM_, when)
28+
import Data.Coerce (coerce)
29+
import qualified Data.Map.Strict as Map
30+
import Data.Maybe (fromJust, fromMaybe, catMaybes)
31+
import qualified Control.Exception as E
3732
import Foreign.C.Types
38-
import System.IO (hPutStrLn, stderr)
33+
import System.IO (hPutStrLn, stderr)
3934

40-
import qualified Sound.Osc.Fd as O
35+
import qualified Sound.Osc.Fd as O
4136

42-
import Data.List (sortOn)
43-
import qualified Sound.Tidal.Clock as Clock
44-
import Sound.Tidal.Core (stack, (#))
37+
import Sound.Tidal.Stream.Config
38+
import Sound.Tidal.Core (stack, (#))
4539
import Sound.Tidal.ID
46-
import qualified Sound.Tidal.Link as Link
47-
import Sound.Tidal.Params (pS)
40+
import qualified Sound.Tidal.Link as Link
41+
import qualified Sound.Tidal.Clock as Clock
42+
import Sound.Tidal.Params (pS)
4843
import Sound.Tidal.Pattern
49-
import Sound.Tidal.Show ()
50-
import Sound.Tidal.Stream.Config
51-
import Sound.Tidal.Utils ((!!!))
44+
import Sound.Tidal.Utils ((!!!))
45+
import Data.List (sortOn)
46+
import Sound.Tidal.Show ()
5247

53-
import Sound.Tidal.Stream.Target
5448
import Sound.Tidal.Stream.Types
49+
import Sound.Tidal.Stream.Target
5550

5651
data ProcessedEvent =
5752
ProcessedEvent {
58-
peHasOnset :: Bool,
59-
peEvent :: Event ValueMap,
60-
peCps :: Link.BPM,
61-
peDelta :: Link.Micros,
62-
peCycle :: Time,
63-
peOnWholeOrPart :: Link.Micros,
53+
peHasOnset :: Bool,
54+
peEvent :: Event ValueMap,
55+
peCps :: Link.BPM,
56+
peDelta :: Link.Micros,
57+
peCycle :: Time,
58+
peOnWholeOrPart :: Link.Micros,
6459
peOnWholeOrPartOsc :: O.Time,
65-
peOnPart :: Link.Micros,
66-
peOnPartOsc :: O.Time
60+
peOnPart :: Link.Micros,
61+
peOnPartOsc :: O.Time
6762
}
6863

6964
-- | Query the current pattern (contained in argument @stream :: Stream@)
@@ -112,7 +107,7 @@ doTick stateMV playMV globalFMV cxs (st,end) nudge ops =
112107
tes <- processCps ops es'
113108
-- For each OSC target
114109
forM_ cxs $ \cx@(Cx target _ oscs _ _ bussesMV) -> do
115-
busses <- mapM readMVar bussesMV
110+
busses <- mapM readMVar bussesMV
116111
-- Latency is configurable per target.
117112
-- Latency is only used when sending events live.
118113
let latency = oLatency target
@@ -230,15 +225,15 @@ toData (OSC {args = Named rqrd}) e
230225
toData _ _ = Nothing
231226

232227
toDatum :: Value -> O.Datum
233-
toDatum (VF x) = O.float x
234-
toDatum (VN x) = O.float x
235-
toDatum (VI x) = O.int32 x
236-
toDatum (VS x) = O.string x
237-
toDatum (VR x) = O.float $ ((fromRational x) :: Double)
238-
toDatum (VB True) = O.int32 (1 :: Int)
228+
toDatum (VF x) = O.float x
229+
toDatum (VN x) = O.float x
230+
toDatum (VI x) = O.int32 x
231+
toDatum (VS x) = O.string x
232+
toDatum (VR x) = O.float $ ((fromRational x) :: Double)
233+
toDatum (VB True) = O.int32 (1 :: Int)
239234
toDatum (VB False) = O.int32 (0 :: Int)
240-
toDatum (VX xs) = O.Blob $ O.blob_pack xs
241-
toDatum _ = error "toDatum: unhandled value"
235+
toDatum (VX xs) = O.Blob $ O.blob_pack xs
236+
toDatum _ = error "toDatum: unhandled value"
242237

243238
substitutePath :: String -> ValueMap -> Maybe String
244239
substitutePath str cm = parse str
@@ -256,19 +251,19 @@ getString :: ValueMap -> String -> Maybe String
256251
getString cm s = (simpleShow <$> Map.lookup param cm) <|> defaultValue dflt
257252
where (param, dflt) = break (== '=') s
258253
simpleShow :: Value -> String
259-
simpleShow (VS str) = str
260-
simpleShow (VI i) = show i
261-
simpleShow (VF f) = show f
262-
simpleShow (VN n) = show n
263-
simpleShow (VR r) = show r
264-
simpleShow (VB b) = show b
265-
simpleShow (VX xs) = show xs
266-
simpleShow (VState _) = show "<stateful>"
254+
simpleShow (VS str) = str
255+
simpleShow (VI i) = show i
256+
simpleShow (VF f) = show f
257+
simpleShow (VN n) = show n
258+
simpleShow (VR r) = show r
259+
simpleShow (VB b) = show b
260+
simpleShow (VX xs) = show xs
261+
simpleShow (VState _) = show "<stateful>"
267262
simpleShow (VPattern _) = show "<pattern>"
268-
simpleShow (VList _) = show "<list>"
263+
simpleShow (VList _) = show "<list>"
269264
defaultValue :: String -> Maybe String
270265
defaultValue ('=':dfltVal) = Just dfltVal
271-
defaultValue _ = Nothing
266+
defaultValue _ = Nothing
272267

273268
playStack :: PlayMap -> ControlPattern
274269
playStack pMap = stack . (map pattern) . (filter active) . Map.elems $ pMap
@@ -318,5 +313,5 @@ setPreviousPatternOrSilence playMV =
318313
modifyMVar_ playMV $ return
319314
. Map.map ( \ pMap -> case history pMap of
320315
_:p:ps -> pMap { pattern = p, history = p:ps }
321-
_ -> pMap { pattern = silence, history = [silence] }
316+
_ -> pMap { pattern = silence, history = [silence] }
322317
)

src/Sound/Tidal/Stream/Types.hs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
module Sound.Tidal.Stream.Types where
22

33
import Control.Concurrent.MVar
4-
import qualified Data.Map.Strict as Map
5-
import Sound.Tidal.Pattern
6-
import Sound.Tidal.Show ()
4+
import qualified Data.Map.Strict as Map
5+
import Sound.Tidal.Pattern
6+
import Sound.Tidal.Show ()
77

8-
import qualified Network.Socket as N
9-
import qualified Sound.Osc.Fd as O
8+
import qualified Sound.Osc.Fd as O
9+
import qualified Network.Socket as N
1010

11-
import qualified Sound.Tidal.Clock as Clock
11+
import qualified Sound.Tidal.Clock as Clock
1212

13-
import Sound.Tidal.Stream.Config
13+
import Sound.Tidal.Stream.Config
1414

15-
data Stream = Stream {sConfig :: Config,
16-
sStateMV :: MVar ValueMap,
15+
data Stream = Stream {sConfig :: Config,
16+
sStateMV :: MVar ValueMap,
1717
-- sOutput :: MVar ControlPattern,
18-
sClockRef :: Clock.ClockRef,
19-
sListen :: Maybe O.Udp,
20-
sPMapMV :: MVar PlayMap,
18+
sClockRef :: Clock.ClockRef,
19+
sListen :: Maybe O.Udp,
20+
sPMapMV :: MVar PlayMap,
2121
sGlobalFMV :: MVar (ControlPattern -> ControlPattern),
22-
sCxs :: [Cx]
22+
sCxs :: [Cx]
2323
}
2424

25-
data Cx = Cx {cxTarget :: Target,
26-
cxUDP :: O.Udp,
27-
cxOSCs :: [OSC],
28-
cxAddr :: N.AddrInfo,
25+
data Cx = Cx {cxTarget :: Target,
26+
cxUDP :: O.Udp,
27+
cxOSCs :: [OSC],
28+
cxAddr :: N.AddrInfo,
2929
cxBusAddr :: Maybe N.AddrInfo,
30-
cxBusses :: Maybe (MVar [Int])
30+
cxBusses :: Maybe (MVar [Int])
3131
}
3232

3333
data StampStyle = BundleStamp
@@ -38,13 +38,13 @@ data Schedule = Pre StampStyle
3838
| Live
3939
deriving (Eq, Show)
4040

41-
data Target = Target {oName :: String,
42-
oAddress :: String,
43-
oPort :: Int,
44-
oBusPort :: Maybe Int,
45-
oLatency :: Double,
46-
oWindow :: Maybe Arc,
47-
oSchedule :: Schedule,
41+
data Target = Target {oName :: String,
42+
oAddress :: String,
43+
oPort :: Int,
44+
oBusPort :: Maybe Int,
45+
oLatency :: Double,
46+
oWindow :: Maybe Arc,
47+
oSchedule :: Schedule,
4848
oHandshake :: Bool
4949
}
5050
deriving Show
@@ -60,8 +60,8 @@ data OSC = OSC {path :: String,
6060
deriving Show
6161

6262
data PlayState = PlayState {pattern :: ControlPattern,
63-
mute :: Bool,
64-
solo :: Bool,
63+
mute :: Bool,
64+
solo :: Bool,
6565
history :: [ControlPattern]
6666
}
6767
deriving Show

src/Sound/Tidal/Stream/UI.hs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
{-# LANGUAGE BangPatterns #-}
2-
{-# LANGUAGE ScopedTypeVariables #-}
1+
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
32
module Sound.Tidal.Stream.UI where
43

4+
import qualified Data.Map as Map
5+
import qualified Control.Exception as E
56
import Control.Concurrent.MVar
6-
import qualified Control.Exception as E
7-
import qualified Data.Map as Map
8-
import System.IO (hPutStrLn, stderr)
9-
import System.Random (getStdRandom, randomR)
7+
import System.IO (hPutStrLn, stderr)
8+
import System.Random (getStdRandom, randomR)
109

11-
import qualified Sound.Tidal.Clock as Clock
10+
import qualified Sound.Tidal.Clock as Clock
11+
import Sound.Tidal.Stream.Types
1212
import Sound.Tidal.Stream.Config
1313
import Sound.Tidal.Stream.Process
14-
import Sound.Tidal.Stream.Types
1514

16-
import Sound.Tidal.ID
1715
import Sound.Tidal.Pattern
16+
import Sound.Tidal.ID
1817

1918
streamNudgeAll :: Stream -> Double -> IO ()
2019
streamNudgeAll s = Clock.setNudge (sClockRef s)
@@ -51,10 +50,10 @@ streamList s = do pMap <- readMVar (sPMapMV s)
5150
let hs = hasSolo pMap
5251
putStrLn $ concatMap (showKV hs) $ Map.toList pMap
5352
where showKV :: Bool -> (PatId, PlayState) -> String
54-
showKV True (k, (PlayState {solo = True})) = k ++ " - solo\n"
55-
showKV True (k, _) = "(" ++ k ++ ")\n"
53+
showKV True (k, (PlayState {solo = True})) = k ++ " - solo\n"
54+
showKV True (k, _) = "(" ++ k ++ ")\n"
5655
showKV False (k, (PlayState {solo = False})) = k ++ "\n"
57-
showKV False (k, _) = "(" ++ k ++ ") - muted\n"
56+
showKV False (k, _) = "(" ++ k ++ ") - muted\n"
5857

5958
streamReplace :: Stream -> ID -> ControlPattern -> IO ()
6059
streamReplace stream k !pat = do
@@ -138,4 +137,4 @@ streamSetB :: Stream -> String -> Pattern Bool -> IO ()
138137
streamSetB = streamSet
139138

140139
streamSetR :: Stream -> String -> Pattern Rational -> IO ()
141-
streamSetR = streamSet
140+
streamSetR = streamSet

0 commit comments

Comments
 (0)