[Haskell-cafe] Optimization help needed

Joel Reymont joelr1 at gmail.com
Fri Dec 23 12:30:03 EST 2005


On Dec 23, 2005, at 11:58 AM, Bulat Ziganshin wrote:

> Hello Joel,
> Thursday, December 22, 2005, 7:27:17 PM, you wrote:
> JR> #ifdef BIG_ENDIAN
> JR> swap16 v = (v `shiftR` 8) .|. (v  `shiftL` 8)
> JR> #else
> JR> swap16 v = v
> JR> #endif
> afaik, your code anyway will not work on non-x86 architectures,
> because your `storable` definition use unaligned reads which are not
> supported outside x86 world

I don't think I understand what you are talking about. Are you  
referring to the code that you quoted or some other code? I'm on  
PowerPC / Mac OSX and the code above works for me.

> and about ":+:" - read "Derivable type classes
> [http://research.microsoft.com/~simonpj/Papers/derive.ps.gz]" and
> "7.11. Generic classes" of ghc manual

I'll take a look, thanks! My question was _not_ what :+: was but how  
to pass a "list" of, say, a :+: b to my constructor Foo Int String  
(assuming types match) such that a is taken as  the Int argument and  
b as the String one.

	Thanks, Joel


More information about the Haskell-Cafe mailing list