1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00
semantic/src/Info.hs
2017-06-24 09:46:28 -04:00

45 lines
1.1 KiB
Haskell

{-# LANGUAGE ConstraintKinds, DataKinds #-}
module Info
( DefaultFields
, HasDefaultFields
, Range(..)
, byteRange
, setByteRange
, Category(..)
, category
, setCategory
, Span(..)
, Pos(..)
, sourceSpan
, setSpan
) where
import Category
import Data.Range
import Data.Record
import Data.Span
-- | The default set of fields produced by our parsers.
type DefaultFields = '[ Range, Category, Span ]
-- | A type alias for HasField constraints commonly used throughout semantic-diff.
type HasDefaultFields fields = (HasField fields Category, HasField fields Range, HasField fields Span)
byteRange :: HasField fields Range => Record fields -> Range
byteRange = getField
setByteRange :: HasField fields Range => Record fields -> Range -> Record fields
setByteRange = setField
category :: HasField fields Category => Record fields -> Category
category = getField
setCategory :: HasField fields Category => Record fields -> Category -> Record fields
setCategory = setField
sourceSpan :: HasField fields Span => Record fields -> Span
sourceSpan = getField
setSpan :: HasField fields Span => Record fields -> Span -> Record fields
setSpan = setField