srcloc 0.5.1.1 → 0.5.1.2
raw patch · 2 files changed
+26/−7 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Loc: instance Data.Semigroup.Semigroup Data.Loc.Loc
+ Data.Loc: instance Data.Semigroup.Semigroup Data.Loc.SrcLoc
- Data.Loc: class IsLocation a where fromPos p = fromLoc (Loc p p)
+ Data.Loc: class IsLocation a
- Data.Loc: class Located a where locOfList xs = mconcat (map locOf xs)
+ Data.Loc: class Located a
Files
- Data/Loc.hs +22/−4
- srcloc.cabal +4/−3
Data/Loc.hs view
@@ -50,6 +50,9 @@ import Data.Typeable (Typeable(..)) import Data.List (foldl') import Data.Monoid (Monoid(..))+#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0))+import Data.Semigroup (Semigroup(..))+#endif -- | Position type. data Pos = -- | Source file name, line, column, and character offset.@@ -130,12 +133,22 @@ locEnd NoLoc = NoLoc locEnd (Loc _ p) = Loc p p +-- | Append two locations.+locAppend :: Loc -> Loc -> Loc+locAppend NoLoc l = l+locAppend l NoLoc = l+locAppend (Loc b1 e1) (Loc b2 e2) = Loc (min b1 b2) (max e1 e2)++#if MIN_VERSION_base(4,9,0)+instance Semigroup Loc where+ (<>) = locAppend+#endif+ instance Monoid Loc where mempty = NoLoc-- NoLoc `mappend` l = l- l `mappend` NoLoc = l- Loc b1 e1 `mappend` Loc b2 e2 = Loc (min b1 b2) (max e1 e2)+#if !(MIN_VERSION_base(4,11,0))+ mappend = locAppend+#endif -- | Merge the locations of two 'Located' values. (<-->) :: (Located a, Located b) => a -> b -> Loc@@ -147,6 +160,11 @@ -- to be compared modulo location information. newtype SrcLoc = SrcLoc Loc deriving (Monoid, Data, Typeable)++#if MIN_VERSION_base(4,9,0)+instance Semigroup SrcLoc where+ SrcLoc l1 <> SrcLoc l2 = SrcLoc (l1 <> l2)+#endif instance Eq SrcLoc where _ == _ = True
srcloc.cabal view
@@ -1,10 +1,10 @@ name: srcloc-version: 0.5.1.1+version: 0.5.1.2 cabal-version: >= 1.6 license: BSD3 license-file: LICENSE copyright: (c) 2006-2011 Harvard University- (c) 2011-2017 Geoffrey Mainland+ (c) 2011-2018 Geoffrey Mainland author: Geoffrey Mainland <mainland@drexel.edu> maintainer: Geoffrey Mainland <mainland@drexel.edu> stability: alpha@@ -12,7 +12,8 @@ category: Data synopsis: Data types for managing source code locations. description: Data types for tracking, combining, and printing source code locations.-tested-with: GHC==7.4.2, GHC==7.6.3, GHC==7.8.3, GHC==7.10.3, GHC==8.0.2, GHC==8.2.1+tested-with: GHC==7.4.2, GHC==7.6.3, GHC==7.8.3, GHC==7.10.3, GHC==8.0.2,+ GHC==8.2.2, GHC==8.4.1 build-type: Simple