@@ -2,7 +2,6 @@ module Data.Schematic.Path where
22
33import Data.Foldable as F
44import Data.Monoid
5−import Data.Singletons
65import Data.Singletons.Prelude
76import Data.Singletons.TypeLits
87import Data.Text as T
@@ -26,10 +25,10 @@ demotePath = go []
2625 where
2726 go :: [DemotedPathSegment] -> Sing (ps :: [PathSegment]) -> [DemotedPathSegment]
2827 go acc SNil = acc
29− go acc (SCons p ps) = go (acc ++ [demote p]) ps
30− demote :: Sing (ps :: PathSegment) -> DemotedPathSegment
31− demote (SKey s) = DKey $ T.pack $ withKnownSymbol s $ symbolVal s
32− demote (SIx n) = DIx $ withKnownNat n $ fromIntegral $ natVal n
28+ go acc (SCons p ps) = go (acc ++ [demotePathSeg p]) ps
29+ demotePathSeg :: Sing (ps :: PathSegment) -> DemotedPathSegment
30+ demotePathSeg (SKey s) = DKey $ T.pack $ withKnownSymbol s $ symbolVal s
31+ demotePathSeg (SIx n) = DIx $ withKnownNat n $ fromIntegral $ natVal n
3332
3433demotedPathToText :: [DemotedPathSegment] -> JSONPath
3534demotedPathToText = JSONPath . F.foldl' renderPathSegment ""