packages feed

keiro-dsl-0.12.0.0: test/conformance-domain-outcomes/Generated/DomainOutcomes/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 5) from context domain-outcomes behavior source map; do not edit.
module Generated.DomainOutcomes.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-0b1588f69a27bc77" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/domain-command-outcomes.keiro" 17 3)
  "behavior-v1-316c9e96fc1a94b1" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/domain-command-outcomes.keiro" 23 3)
  "behavior-v1-fd391b55fbbfa640" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/domain-command-outcomes.keiro" 28 3)
  _ -> 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