packages feed

keiro-dsl-0.21.0.0: test/conformance-history-dependent-holes/Generated/HistoryDependentHoles/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.21.0.0 (language keiro-dsl 6) from context history-dependent-holes behavior source map; do not edit.
module Generated.HistoryDependentHoles.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-73b7455c36956c2b" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/history-dependent-holes.keiro" 26 3)
  "behavior-v1-afe574346545beaa" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/history-dependent-holes.keiro" 43 3)
  "behavior-v1-fa59fc344c44f50b" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/history-dependent-holes.keiro" 38 3)
  "behavior-v1-fe7277b756f0ff4b" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/history-dependent-holes.keiro" 32 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