Packages

The Phi Programming Language

Current section

Files

Jump to
phi stdlib Data Atom.phi
Raw

stdlib/Data/Atom.phi

-----------------------------------------------------------------------------
-- |
-- Module : Data.Atom
-- Copyright : (c) 2020-2021 EMQ Technologies Co., Ltd.
-- License : BSD-style (see the LICENSE file)
--
-- Maintainer : Feng Lee, feng@emqx.io
-- Yang M, yangm@emqx.io
-- Stability : experimental
-- Portability : portable
--
-- The Atom datatype.
--
-----------------------------------------------------------------------------
module Data.Atom where
import Foreign (ffi1)
mod :: String -> Atom
mod = atom
-- String to Atom.
atom :: String -> Atom
atom = ffi1 :erlang :list_to_atom
-- String to existing Atom.
existingAtom :: String -> Atom
existingAtom = ffi1 :erlang :list_to_existing_atom
-- | Atom to Binary.
toBinary :: Atom -> Binary
toBinary = ffi1 :erlang :atom_to_binary
-- Atom to String.
toString :: Atom -> String
toString = ffi1 :erlang :atom_to_list