packages feed

keiro-dsl-0.12.0.0: test/conformance-scalar-expressions/Generated/AggregateScalarExpressions/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 4) from context aggregate-scalar-expressions behavior source map; do not edit.
module Generated.AggregateScalarExpressions.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-1de91883b9e3f8bc" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/aggregate-scalar-expressions-v2.keiro" 32 10)
  "behavior-v1-5c58e0aafeb5f400" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/aggregate-scalar-expressions-v2.keiro" 32 15)
  "behavior-v1-a19a8e94d935493f" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/aggregate-scalar-expressions-v2.keiro" 32 24)
  "behavior-v1-b7db52f28632d8da" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/aggregate-scalar-expressions-v2.keiro" 62 3)
  "behavior-v1-dbf483c868dd6d34" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/aggregate-scalar-expressions-v2.keiro" 32 24)
  "behavior-v1-e9c863d5daf20011" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/aggregate-scalar-expressions-v2.keiro" 42 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