@@ -112,6 +112,7 @@ module System.OsPath.MODULE_NAME.Internal
112112
113113{- HLINT ignore "Use fewer imports" -}
114114import Prelude (Char , Bool (.. ), Maybe (.. ), (.) , (&&) , (<=) , not , fst , maybe , (||) , (==) , ($) , otherwise , fmap , mempty , (>=) , (/=) , (++) , snd )
115+ import Data.Bifunctor (first )
115116import Data.Semigroup ((<>) )
116117import qualified Prelude as P
117118import Data.Maybe (isJust )
@@ -129,7 +130,6 @@ import Data.List(stripPrefix, isSuffixOf, uncons, dropWhileEnd)
129130#else
130131import Prelude (fromIntegral )
131132import Control.Exception ( SomeException , evaluate , try , displayException )
132- import Data.Bifunctor (first )
133133import Control.DeepSeq (force )
134134import GHC.IO (unsafePerformIO )
135135import qualified Data.Char as C
@@ -1145,8 +1145,7 @@ stripSuffix xs ys = reverse P.<$> stripPrefix (reverse xs) (reverse ys)
11451145
11461146
11471147unsnoc :: [a ] -> Maybe ([a ], a )
1148- unsnoc [] = Nothing
1149- unsnoc xs = Just (init xs, last xs)
1148+ unsnoc = L. foldr (\ x -> Just . maybe ([] , x) (first (x : ))) Nothing
11501149
11511150
11521151_period , _quotedbl , _backslash , _slash , _question , _U , _N , _C , _colon , _semicolon , _US , _less , _greater , _bar , _asterisk , _nul , _space , _underscore :: Char
0 commit comments