Skip to content

Commit

Permalink
Doctests: Better way to bring Unicode/unicode into scope
Browse files Browse the repository at this point in the history
  • Loading branch information
mmhat committed Aug 11, 2024
1 parent b2b30f0 commit 1faf77a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
3 changes: 2 additions & 1 deletion examples/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- FlexibleContexts is needed for GHC <9.8
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-} -- Needed for GHC <9.8
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RoleAnnotations #-}
Expand Down
6 changes: 5 additions & 1 deletion os-string-aeson-internal/System/OsString/Aeson/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module System.OsString.Aeson.Internal where
module System.OsString.Aeson.Internal (
module System.OsString.Aeson.Internal,
Platform.Unicode,
Platform.unicode,
) where

import Control.Monad.Catch (MonadThrow)
import Data.Aeson.Types (
Expand Down
15 changes: 2 additions & 13 deletions src/System/OsString/Aeson.hs
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,20 @@ module System.OsString.Aeson (
-- * Text encodings
TextEncoding,
IsTextEncoding,
PlatformDependent.Unicode,
Unicode,
Utf8,
Utf16LE,
PlatformDependent.unicode,
unicode,
)
where

import System.IO (TextEncoding)
import System.OsString.Aeson.Internal
import System.OsString.Aeson.Internal.Types

#if defined(mingw32_HOST_OS)
import System.OsString.Aeson.Internal.Windows qualified as PlatformDependent
#else
import System.OsString.Aeson.Internal.Posix qualified as PlatformDependent
#endif

-- $setup
-- >>> :set -XOverloadedStrings
-- >>> :set -XQuasiQuotes
-- >>> :set -XTypeApplications
-- >>> import Data.Aeson qualified
-- >>> import System.OsString (osstr)
#if defined(mingw32_HOST_OS)
-- >>> import System.OsString.Aeson.Internal.Windows (Unicode, unicode)
#else
-- >>> import System.OsString.Aeson.Internal.Posix (Unicode, unicode)
#endif

0 comments on commit 1faf77a

Please sign in to comment.