packages feed

keiro-dsl-0.17.0.0: test/conformance-process-state-authority/Generated/IncidentResponse/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.17.0.0 (language keiro-dsl 6) from context incident-response behavior source map; do not edit.
module Generated.IncidentResponse.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-00b0b13023eea6f8" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 81 3)
  "behavior-v1-0aad69728dee8fec" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 97 3)
  "behavior-v1-16209316858bb8c3" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 65 15)
  "behavior-v1-2144226ce8222855" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 73 3)
  "behavior-v1-36c541281e30554e" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 96 3)
  "behavior-v1-3d0e024503e32404" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 84 3)
  "behavior-v1-65795e7a28345559" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 77 3)
  "behavior-v1-75011409d18e29c3" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 65 15)
  "behavior-v1-8f58f8301e7a66f3" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 65 15)
  "behavior-v1-eecae8fa281fddcf" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/process-state-authority.keiro" 65 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