packages feed

keiro-dsl-0.26.0.0: test/conformance-intake-delegated-noop/Generated/DeliveryOutcomes/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.26.0.0 (language keiro-dsl 6) from context delivery-outcomes behavior source map; do not edit.
module Generated.DeliveryOutcomes.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-ac132150262d872a" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/intake-delegated-noop.keiro" 64 3)
  "behavior-v1-ac37ab6d84cb0fa7" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/intake-delegated-noop.keiro" 70 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