Hi,

newtype Strand = Strand Int

uses a single-constructor datatype "Int" as strand repr.

While "Bool" is algebraic with two constructors. This is not optimized
completely. Or maybe "was", I don't know the current status of GHC
regarding this but I think it is still open.

So "True" is a pointer toward a global "True" with an indirection, while
"true = Strand 0" would be an actual "0 :: Int#".

And at least 1 year ago, I had much better performance using newtypes of
Ints instead of "data Nuc = A | C | G | U"

Gruss,
Christian

* Felipe Almeida Lessa <[email protected]> [14.07.2011 16:18]:
> I don't see how
> 
>   newtype Strand = Strand Bool
> 
> would have better performance than
> 
>   data Strand = Plus | Minus
> 
> as both are enumerations (data Bool = True | False).  Something like
> 'if strand == plus then x else y' will likely have the same
> performance characteristics on both cases.
> 
> Cheers, =)
> 
> -- 
> Felipe.

Attachment: pgp1Rbgrs21Sc.pgp
Description: PGP signature

_______________________________________________
Biohaskell mailing list
[email protected]
http://malde.org/cgi-bin/mailman/listinfo/biohaskell

Reply via email to