packages feed

keiro-dsl-0.12.0.0: test/conformance-process-full/Generated/SurgeDemo/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 4) from context surge-demo behavior source map; do not edit.
module Generated.SurgeDemo.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-364cc8c97a1dccd7" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 36 25)
  "behavior-v1-4738b03b129c9778" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 57 3)
  "behavior-v1-7bd417bb60f14aea" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 43 3)
  "behavior-v1-8303777877a78d98" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 36 10)
  "behavior-v1-8cc737e3759c26c7" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 52 15)
  "behavior-v1-9d1377f4e60cd45a" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 36 25)
  "behavior-v1-c7783d8bb46678fe" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 36 19)
  "behavior-v1-db2fec76864e5867" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/surge-service.keiro" 44 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