2-- Module : Streamly.Internal.Unicode.Utf8
3-- Copyright : (c) 2021 Composewell Technologies
4-- License : BSD-3-Clause
5-- Maintainer : streamly@composewell.com
6-- Stability : experimental
9module Streamly.Internal.Unicode.Utf8
14 -- * Creation and elimination
21--------------------------------------------------------------------------------
23--------------------------------------------------------------------------------
25import Control.DeepSeq (NFData)
26import Data.Word (Word8)
27import Streamly.Internal.Data.Array.Foreign.Type (Array)
28import System.IO.Unsafe (unsafePerformIO)
30import qualified Streamly.Internal.Data.Array.Foreign as Array
31import qualified Streamly.Internal.Data.Stream.IsStream as Stream
32import qualified Streamly.Internal.Unicode.Stream as Unicode
34--------------------------------------------------------------------------------
36--------------------------------------------------------------------------------
38-- | A space efficient, packed, unboxed Unicode container.
43--------------------------------------------------------------------------------
45--------------------------------------------------------------------------------
48toArray :: Utf8 -> Array Word8
49toArray (Utf8 arr) = arr
52{-# INLINEABLE pack #-}
57 $ Array.fromStreamN len $ Unicode.encodeUtf8' $ Stream.fromList s
63{-# INLINEABLE unpack #-}
64unpack :: Utf8 -> String
67 $ Stream.toList $ Unicode.decodeUtf8' $ Array.toStream $ toArray u
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list