tags:

views:

69

answers:

1

I'm trying to write a program that will check the file type of a certain file and I found a haskell library that should do the trick. The problem arises when I try to use it. I have no idea what I have to do, which function to call etc. The library is full of cryptic commands with no examples, no tutorial or a homepage.

Please help.

+3  A: 

There is the package's documentation that contains short descriptions of the important functions (which are not that many). For additional information about what the underlying C library does (and therefore also the Haskell library), have a look at libmagic's man page.

The basic usage should look similar to this (untested):

import Magic.Init
import Magic.Operations

main =
   do magic <- magicOpen []
      loadDefaultMagic magic
      magicFile magic "/my/file" >>= print
sth