File: Internal.hs

package info (click to toggle)
haskell-text-icu 0.8.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 536 kB
  • sloc: haskell: 1,210; ansic: 1,147; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 930 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{-# LANGUAGE DeriveDataTypeable, EmptyDataDecls #-}
-- |
-- Module      : Data.Text.ICU.Bidi.Internal
-- Copyright   : (c) Ondrej Palkovsky 2018
--
-- License     : BSD-style
-- Maintainer  : bos@serpentine.com
-- Stability   : experimental
-- Portability : GHC
--
-- Internal types for Unicode bidirectional algorithm

module Data.Text.ICU.BiDi.Internal
    (
      BiDi(..)
    , UBiDi
    , withBiDi
    ) where

import Data.Typeable (Typeable)
import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)
import Foreign.Ptr (Ptr)

data UBiDi

-- | BiDi object.  /Note/: this structure is not
-- thread safe. It is /not/ safe to use value of this type
-- simultaneously from multiple threads.
newtype BiDi = BiDi (ForeignPtr UBiDi)
                 deriving (Eq, Typeable)

instance Show BiDi where
    show _ = "BiDi"

withBiDi :: BiDi -> (Ptr UBiDi -> IO a) -> IO a
{-# INLINE withBiDi #-}
withBiDi (BiDi cnv) = withForeignPtr cnv