Hi,
I'm wrapping a library where functions take
as parameters pointers to a few standard
structs (as, well, all C libraries). I
would like to ensure that only pointers of
correct structs are passed to those functions.
What is the Haskell way to do that? My
idea is to do something like this:
Hello Mauricio,
Wednesday, October 15, 2008, 5:40:16 PM, you wrote:
newtype SomeStruct = SomeStruct ()
data SomeStruct = SomeStruct
looks even simpler. you don't need to shell around () since you anyway
will not use its value :)
--
Best regards,
Bulat
On Thu, Oct 16, 2008 at 12:53 AM, Bulat Ziganshin
[EMAIL PROTECTED] wrote:
data SomeStruct = SomeStruct
You can even go one step further and do
data SomeStruct
which will prevent you from accidentally trying to the dummy
constructor. However, you'll need
{-# LANGUAGE EmptyDataDecls #-}