[Haskell-cafe] Assimp FFI Library

Henning Thielemann lemming at henning-thielemann.de
Tue Apr 12 11:38:16 CEST 2011


On Mon, 11 Apr 2011, Joel Burget wrote:

> I should mention that I'm going to convert all the Storable instances from something
> like this:
> >  peek p = do
> >    w <- (#peek aiQuaternion, w) p
> >    x <- (#peek aiQuaternion, x) p
> >    y <- (#peek aiQuaternion, y) p
> >    z <- (#peek aiQuaternion, z) p
> >    return $ Quaternion w x y z
> 
> to something like this:
> 
> >  peek p = Quaternion <$> (#peek aiQuaternion, w) p 
> >                      <*> (#peek aiQuaternion, w) p 
> >                      <*> (#peek aiQuaternion, w) p
> >                      <*> (#peek aiQuaternion, w) p


I think it must be (pure Quaternion). I have written storable-record 
package that assists with writing such instances.



More information about the Haskell-Cafe mailing list