module Chiasma.Path where

import qualified Data.Text as Text
import Path (Path, toFilePath)

pathText :: Path b t -> Text
pathText :: forall b t. Path b t -> Text
pathText =
  FilePath -> Text
forall a. ToText a => a -> Text
toText (FilePath -> Text) -> (Path b t -> FilePath) -> Path b t -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path b t -> FilePath
forall b t. Path b t -> FilePath
toFilePath
{-# inline pathText #-}

pathText' :: Path b t -> Text
pathText' :: forall b t. Path b t -> Text
pathText' Path b t
p =
  case Path b t -> Text
forall b t. Path b t -> Text
pathText Path b t
p of
    Text
"/" -> Text
"/"
    Text
t -> (Char -> Bool) -> Text -> Text
Text.dropWhileEnd (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'/') Text
t
{-# inline pathText' #-}