packages feed

keiro-dsl-0.17.0.0: test/conformance-process-timers/Generated/ProcessTimers/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.17.0.0 (language keiro-dsl 6) from context process-timers behavior source map; do not edit.
module Generated.ProcessTimers.BehaviorSourceMap
  ( BehaviorSourceLocation (..)
  , behaviorSourceLocation
  , renderBehaviorSourceLocation
  ) where

import Data.Text (Text)
import Data.Text qualified as T

data BehaviorSourceLocation = BehaviorSourceLocation
  { file :: !FilePath
  , line :: !Int
  , column :: !Int
  }
  deriving stock (Eq, Ord, Show)

behaviorSourceLocation :: Text -> Maybe BehaviorSourceLocation
behaviorSourceLocation key = case key of
  "behavior-v1-48ce258ccf64ef4e" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-timers.keiro" 55 15)
  "behavior-v1-93455a87d5151176" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-timers.keiro" 61 3)
  "behavior-v1-af16dd42cbccd576" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-timers.keiro" 51 3)
  "behavior-v1-b944c85b616b9349" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-timers.keiro" 60 3)
  "behavior-v1-d66d007f74139a07" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-timers.keiro" 55 15)
  _ -> Nothing

renderBehaviorSourceLocation :: Text -> Text
renderBehaviorSourceLocation key = case behaviorSourceLocation key of
  Just location -> T.pack location.file <> ":" <> tshow location.line <> ":" <> tshow location.column
  Nothing -> "<internal invariant: missing behavior source for " <> key <> ">"

tshow :: Show value => value -> Text
tshow = T.pack . show