keiro-dsl-0.12.0.0: test/conformance-declarative-router/Generated/TransferRouting/BehaviorSourceMap.hs
-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 5) from context transfer-routing behavior source map; do not edit.
module Generated.TransferRouting.BehaviorSourceMap
( BehaviorSourceLocation (..)
, behaviorSourceLocation
, renderBehaviorSourceLocation
) where
import Data.Text (Text)
import Data.Text qualified as T
data BehaviorSourceLocation = BehaviorSourceLocation
{ sourceFile :: !FilePath
, sourceLine :: !Int
, sourceColumn :: !Int
}
deriving stock (Eq, Ord, Show)
behaviorSourceLocation :: Text -> Maybe BehaviorSourceLocation
behaviorSourceLocation key = case key of
"behavior-v1-51a443ca8bbb0eab" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/declarative-router/valid.keiro" 66 15)
"behavior-v1-6dc56a81dec7fe2b" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/declarative-router/valid.keiro" 71 3)
_ -> Nothing
renderBehaviorSourceLocation :: Text -> Text
renderBehaviorSourceLocation key = case behaviorSourceLocation key of
Just location -> T.pack (sourceFile location) <> ":" <> tshow (sourceLine location) <> ":" <> tshow (sourceColumn location)
Nothing -> "<internal invariant: missing behavior source for " <> key <> ">"
tshow :: Show value => value -> Text
tshow = T.pack . show