1{-# LANGUAGE CPP #-}
2{-# LANGUAGE NoImplicitPrelude #-}
3{-# OPTIONS_GHC -fno-warn-dodgy-exports #-} -- Char8
4
5-- |
6-- Module      : Network.TLS.Imports
7-- License     : BSD-style
8-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
9-- Stability   : experimental
10-- Portability : unknown
11--
12module Network.TLS.Imports
13    (
14    -- generic exports
15      ByteString
16    , module Data.ByteString.Char8 -- instance
17    , module Control.Applicative
18    , module Control.Monad
19#if !MIN_VERSION_base(4,13,0)
20    , MonadFail
21#endif
22    , module Data.Bits
23    , module Data.List
24    , module Data.Maybe
25#if MIN_VERSION_base(4,9,0)
26    , module Data.Semigroup
27#else
28    , module Data.Monoid
29#endif
30    , module Data.Ord
31    , module Data.Word
32#if !MIN_VERSION_base(4,8,0)
33    , sortOn
34#endif
35    -- project definition
36    , showBytesHex
37    ) where
38
39import Data.ByteString (ByteString)
40import Data.ByteString.Char8 ()
41
42import Control.Applicative
43import Control.Monad
44#if !MIN_VERSION_base(4,13,0)
45import Control.Monad.Fail (MonadFail)
46#endif
47import Data.Bits
48import Data.List
49import Data.Maybe hiding (fromJust)
50#if MIN_VERSION_base(4,9,0)
51import Data.Semigroup
52#else
53import Data.Monoid
54#endif
55import Data.Ord
56import Data.Word
57
58import Data.ByteArray.Encoding as B
59import qualified Prelude as P
60
61#if !MIN_VERSION_base(4,8,0)
62import Prelude ((.))
63
64sortOn :: Ord b => (a -> b) -> [a] -> [a]
65sortOn f =
66  map P.snd . sortBy (comparing P.fst) . map (\x -> let y = f x in y `P.seq` (y, x))
67#endif
68
69showBytesHex :: ByteString -> P.String
70showBytesHex bs = P.show (B.convertToBase B.Base16 bs :: ByteString)
71
72