packages feed

keiro-dsl-0.12.0.0: test/conformance-replay/Generated/ReplayDivergence/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 4) from context replay-divergence behavior source map; do not edit.
module Generated.ReplayDivergence.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-248e9c1b1eb3e5bc" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/replay-divergence.keiro" 12 3)
  "behavior-v1-7c36eda198514110" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/replay-divergence.keiro" 7 16)
  _ -> 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