Packages

The Phi Programming Language

Current section

Files

Jump to
phi lib Data Ref.hm
Raw

lib/Data/Ref.hm

-----------------------------------------------------------------------------
-- |
-- Module : Data.Ref
-- 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 Erlang Reference datatype.
--
-----------------------------------------------------------------------------
module Data.Ref where
import Control.Monad (IO)
import Data.Eq (class Eq)
import Data.Ord
( class Ord
, Ordering(..)
)
import Data.Show (class Show)
-- | An alias for erlang `Reference`
type Ref = Reference
-- |
-- Erlang reference is a term that is unique in an Erlang runtime system,
-- created by calling `make_ref`.
--
foreign import data Reference :: Type
foreign import makeRef :: IO Reference
instance Eq Reference where
eq = eqRefImpl
instance Ord Reference where
compare = cmpRefImpl LT EQ GT
instance Show Reference where
show = showRefImpl
foreign import eqRefImpl
:: Reference -> Reference -> Boolean
foreign import cmpRefImpl
:: Ordering
-> Ordering
-> Ordering
-> Reference
-> Reference
-> Ordering
foreign import showRefImpl :: Reference -> String