on master help sign in
Fix warning about shadowed 'demote'
7b965a3Dmitry Bushev
src/Data/Schematic/Path.hs+4−5
@@ -2,7 +2,6 @@ module Data.Schematic.Path where
2
2
3import Data.Foldable as F
3import Data.Foldable as F
4import Data.Monoid
4import Data.Monoid
5−import Data.Singletons
6import Data.Singletons.Prelude
5import Data.Singletons.Prelude
7import Data.Singletons.TypeLits
6import Data.Singletons.TypeLits
8import Data.Text as T
7import Data.Text as T
@@ -26,10 +25,10 @@ demotePath = go []
26 where
25 where
27 go :: [DemotedPathSegment] -> Sing (ps :: [PathSegment]) -> [DemotedPathSegment]
26 go :: [DemotedPathSegment] -> Sing (ps :: [PathSegment]) -> [DemotedPathSegment]
28 go acc SNil = acc
27 go acc SNil = acc
29− go acc (SCons p ps) = go (acc ++ [demote p]) ps
28+ go acc (SCons p ps) = go (acc ++ [demotePathSeg p]) ps
30− demote :: Sing (ps :: PathSegment) -> DemotedPathSegment
29+ demotePathSeg :: Sing (ps :: PathSegment) -> DemotedPathSegment
31− demote (SKey s) = DKey $ T.pack $ withKnownSymbol s $ symbolVal s
30+ demotePathSeg (SKey s) = DKey $ T.pack $ withKnownSymbol s $ symbolVal s
32− demote (SIx n) = DIx $ withKnownNat n $ fromIntegral $ natVal n
31+ demotePathSeg (SIx n) = DIx $ withKnownNat n $ fromIntegral $ natVal n
33
32
34demotedPathToText :: [DemotedPathSegment] -> JSONPath
33demotedPathToText :: [DemotedPathSegment] -> JSONPath
35demotedPathToText = JSONPath . F.foldl' renderPathSegment ""
34demotedPathToText = JSONPath . F.foldl' renderPathSegment ""