Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Barros committed Mar 16, 2024
1 parent 144f852 commit 83358d1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- group: { name: generalise, enabled: true }
- group: {name: partial, enabled: true}

- arguments: [ --cross, --refactor, --color, -XQuasiQuotes]
- arguments: [ --cross, --refactor, -XQuasiQuotes]
#- arguments: [ --cross, --color, -XQuasiQuotes]

- extensions:
Expand Down
20 changes: 9 additions & 11 deletions src/Data/WAVE.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
-- Modified from:
-- Copyright (C) 2007 Bart Massey

-- | This module implements reading and writing of the most
-- common kinds of WAVE files. WAVE files are Microsoft
Expand Down Expand Up @@ -54,14 +52,14 @@ import System.IO
-- | For internal use only; the header as it appears on-disk.
-- The interface cleans this up to remove redundancy and
-- make things easier to understand.
data WAVERawHeader = WAVERawHeader
{ rawNumChannels :: Int, -- Number of channels in the audio
rawSampleRate :: Int, -- Sample rate of the audio
rawByteRate :: Int, -- Byte rate of the audio
rawBlockAlign :: Int, -- Block alignment of the audio
rawBitsPerSample :: Int, -- Bits per sample of the audio
rawFrames :: Maybe Int -- Number of frames in the audio stream (if present)
}
data WAVERawHeader where
WAVERawHeader :: {rawNumChannels :: Int,
rawSampleRate :: Int,
rawByteRate :: Int,
rawBlockAlign :: Int,
rawBitsPerSample :: Int,
rawFrames :: Maybe Int} ->
WAVERawHeader

-- | Descriptive information for the audio source.
data WAVEHeader = WAVEHeader
Expand Down Expand Up @@ -128,7 +126,7 @@ sampleToDouble v =
minb = toInteger (minBound :: WAVESample)
in if v >= 0
then fromInteger (toInteger v) / fromInteger maxb
else -fromInteger (toInteger v) / fromInteger minb
else - (fromInteger (toInteger v) / fromInteger minb)

-- | Utility routine for working with audio data in floating
-- point format.
Expand Down
1 change: 1 addition & 0 deletions src/Rtm/Parser.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
module Rtm.Parser
( rtmParser,
parseRtm,
Expand Down
4 changes: 3 additions & 1 deletion src/Rtm/Shape.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Rtm.Common
import System.Random.Shuffle (shuffleM)

-- | Tree structure that holds placeholders for the shape of the tree
data ShapeTree a = ShapeLeaf | ShapeNode a [ShapeTree a]
data ShapeTree a where
ShapeLeaf :: ShapeTree a
ShapeNode :: a -> [ShapeTree a] -> ShapeTree a
deriving (Functor, Show)

-- Function to extract the shape of an Rtm
Expand Down

0 comments on commit 83358d1

Please sign in to comment.