packages feed

keiro-dsl-0.17.0.0: test/conformance-process-reactions/Generated/ProcessReactions/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.17.0.0 (language keiro-dsl 6) from context process-reactions behavior source map; do not edit.
module Generated.ProcessReactions.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-4126b087f05aadf6" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-reactions.keiro" 769 3)
  "behavior-v1-6b66722f9f2463d3" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-reactions.keiro" 761 3)
  "behavior-v1-825e6c1709cb63b4" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-reactions.keiro" 762 3)
  _ -> 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