libmagic-1.2: Magic/TypesLL.hsc
{- -*- Mode: haskell; -*-
Haskell magic Interface
Copyright (C) 2005 John Goerzen <jgoerzen@complete.org>
This code is under a 3-clause BSD license; see COPYING for details.
-}
{- |
Module : Magic.TypesLL
Copyright : Copyright (C) 2005 John Goerzen
License : BSD
Maintainer : Joey Hess,
Maintainer : id\@joeyh.name
Stability : provisional
Portability: portable
Low-Types for magic programs.
Written by John Goerzen, jgoerzen\@complete.org
-}
module Magic.TypesLL(CMagic, Magic(..))
where
import Foreign.ForeignPtr
import Control.Concurrent.MVar
#include <magic.h>
data CMagic
{- | Main Magic handle.
Magic objects are automatically closed (and memory freed) when they are
garbage-collected by Haskell. There is no need to explicitly close them.
Access to the C library is serialized, so multiple threads may safely
use the same Magic handle.
-}
newtype Magic = Magic (MVar (ForeignPtr CMagic))