packages feed

keiro-dsl-0.12.0.0: test/conformance-snapshot/Generated/HospitalCapacity/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 4) from context hospital-capacity behavior source map; do not edit.
module Generated.HospitalCapacity.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-a544566ac00664fb" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/reservation-snapshot.keiro" 20 22)
  "behavior-v1-bf9ebe70beb18440" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/reservation-snapshot.keiro" 32 3)
  "behavior-v1-cf40a84edc844a41" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/reservation-snapshot.keiro" 20 27)
  "behavior-v1-dff0853d3cd55550" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/reservation-snapshot.keiro" 28 3)
  "behavior-v1-e53a65263ad89283" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/reservation-snapshot.keiro" 20 27)
  "behavior-v1-e7378f31cfa93bbf" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/reservation-snapshot.keiro" 20 10)
  _ -> 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