-- Copyright 2013 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

module Perform.Warning where
import qualified Control.DeepSeq as DeepSeq

import qualified Derive.Stack as Stack
import Types


data Warning = Warning {
    Warning -> String
warn_msg :: String
    , Warning -> Stack
warn_event :: Stack.Stack
    -- | Range that the warning covers.  It should be within the event's
    -- range.  It's in real time, so it needs to be converted back to
    -- score time, and it's (start, end) rather than (start, dur).
    -- TODO: convert these back to ScoreTime with the tempo map
    -- then I can put them in the stack
    , Warning -> Maybe (RealTime, RealTime)
warn_pos :: Maybe (RealTime, RealTime)
    } deriving (Warning -> Warning -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Warning -> Warning -> Bool
$c/= :: Warning -> Warning -> Bool
== :: Warning -> Warning -> Bool
$c== :: Warning -> Warning -> Bool
Eq, Int -> Warning -> ShowS
[Warning] -> ShowS
Warning -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Warning] -> ShowS
$cshowList :: [Warning] -> ShowS
show :: Warning -> String
$cshow :: Warning -> String
showsPrec :: Int -> Warning -> ShowS
$cshowsPrec :: Int -> Warning -> ShowS
Show)
warning :: String -> Stack -> Maybe (RealTime, RealTime) -> Warning
warning = String -> Stack -> Maybe (RealTime, RealTime) -> Warning
Warning

instance DeepSeq.NFData Warning where
    rnf :: Warning -> ()
rnf (Warning String
msg Stack
stack Maybe (RealTime, RealTime)
pos) = forall a. NFData a => a -> ()
DeepSeq.rnf String
msg seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
DeepSeq.rnf Stack
stack
        seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
DeepSeq.rnf Maybe (RealTime, RealTime)
pos