packages feed

keiro-dsl-0.18.0.0: test/conformance-id-admission-domains/Generated/IdAdmissionDomains/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.18.0.0 (language keiro-dsl 6) from context id-admission-domains behavior source map; do not edit.
module Generated.IdAdmissionDomains.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-0bc43a8eaf58f2f2" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/id-admission-domains.keiro" 33 3)
  "behavior-v1-54975b0ac4e921b5" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/id-admission-domains.keiro" 28 3)
  "behavior-v1-5acf27af287654ab" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/id-admission-domains.keiro" 22 10)
  _ -> 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