{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Ivory.Language.Ptr
( Ptr
, nullPtr
, ptrToRef
, refToPtr
, withRef
) where
import Ivory.Language.Area
import Ivory.Language.Pointer
(Constancy(Mutable), Nullability(Nullable), Pointer,
pointerCastToNullable, unsafePointerCast, nullPtr, withRef)
import Ivory.Language.Ref
type Ptr = Pointer 'Nullable 'Mutable
refToPtr :: IvoryArea area => Ref s area -> Ptr s area
refToPtr = pointerCastToNullable
ptrToRef :: IvoryArea area => Ptr s area -> Ref s area
ptrToRef = unsafePointerCast