-- | Some IORefs to access option values in pure code

module Agda.Interaction.Options.IORefs
    ( UnicodeOrAscii(..)
    , unicodeOrAscii
    ) where

import Data.IORef
import qualified System.IO.Unsafe as UNSAFE

-- | In `Agda.Syntax.Concrete.Pretty` and `Agda.Utils.String` we want to know
-- whether we are allowed to insert unicode characters or not.

data UnicodeOrAscii = UnicodeOk | AsciiOnly

{-# NOINLINE unicodeOrAscii #-}
unicodeOrAscii :: IORef UnicodeOrAscii
unicodeOrAscii :: IORef UnicodeOrAscii
unicodeOrAscii = IO (IORef UnicodeOrAscii) -> IORef UnicodeOrAscii
forall a. IO a -> a
UNSAFE.unsafePerformIO (IO (IORef UnicodeOrAscii) -> IORef UnicodeOrAscii)
-> IO (IORef UnicodeOrAscii) -> IORef UnicodeOrAscii
forall a b. (a -> b) -> a -> b
$ UnicodeOrAscii -> IO (IORef UnicodeOrAscii)
forall a. a -> IO (IORef a)
newIORef UnicodeOrAscii
UnicodeOk