Skip to content

Commit 974d97c

Browse files
author
kokobd
committed
add some doc comments
1 parent c45d471 commit 974d97c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lsp-types/src/Language/LSP/Types/Uri.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,8 @@ toNormalizedFilePath fp = NormalizedFilePath nuri . encodeFilePath $ nfp
218218
nfp = FP.normalise fp
219219
nuri = internalNormalizedFilePathToUri nfp
220220

221-
-- | Extract 'FilePath' from 'NormalizedFilePath'.
222-
-- The function is total if 'NormalizedFilePath' is valid. The 'HasCallStack' constraint is added
223-
-- for debugging purpose, in case an invalid
221+
-- | Extracts 'FilePath' from 'NormalizedFilePath'.
222+
-- The function is total. The 'HasCallStack' constraint is added for debugging purpose only.
224223
fromNormalizedFilePath :: HasCallStack => NormalizedFilePath -> FilePath
225224
fromNormalizedFilePath (NormalizedFilePath _ fp) =
226225
case decodeFilePath fp of
@@ -239,6 +238,7 @@ emptyNormalizedUri =
239238
let s = "file://"
240239
in NormalizedUri (hash s) s
241240

241+
-- | 'NormalizedFilePath' that contains an empty file path
242242
emptyNormalizedFilePath :: NormalizedFilePath
243243
emptyNormalizedFilePath = NormalizedFilePath emptyNormalizedUri ""
244244

lsp-types/src/Language/LSP/Types/Uri/OsPath.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@ module Language.LSP.Types.Uri.OsPath
1616
#ifdef OS_PATH
1717

1818
import Control.DeepSeq (NFData, force)
19+
import Control.Exception hiding (try)
1920
import Control.Monad.Catch
20-
import GHC.IO (evaluate)
2121
import Language.LSP.Types.Uri
2222
import System.IO.Unsafe (unsafePerformIO)
2323
import System.OsPath
2424

25+
{-|
26+
Constructs 'NormalizedFilePath' from 'OsPath'. Throws 'IOException' if the conversion fails.
27+
-}
2528
osPathToNormalizedFilePath :: MonadThrow m => OsPath -> m NormalizedFilePath
2629
osPathToNormalizedFilePath = fmap toNormalizedFilePath . unsafePerformIO' . decodeFS
2730

31+
{-|
32+
Extracts 'OsPath' from 'NormalizedFilePath'. Throws 'IOException' if the conversion fails.
33+
-}
2834
normalizedFilePathToOsPath :: MonadThrow m => NormalizedFilePath -> m OsPath
2935
normalizedFilePathToOsPath = unsafePerformIO' . encodeFS . fromNormalizedFilePath
3036

0 commit comments

Comments
 (0)