[Haskell-beginners] Netwire fromRational
Ertugrul Söylemez
es at ertes.de
Wed Oct 3 14:04:41 CEST 2012
Nathan Hüsken <nathan.huesken at posteo.de> wrote:
> I noticed than when using this code:
>
> (-1.0) . isKeyPressed leftKeyCode <|> 0.0
>
> instead of
>
> (pure (-1.0)) . isKeyPressed leftKeyCode <|> (pure 0.0)
>
> than "fromRational" gets called. I am wondering, if this is not pretty
> inefficient.
No, it's the same thing. When you write 'pure 1.0', then you're using,
say, Double's Fractional instance directly. If you write just '1.0',
then you're using Wire's Fractional instance, which is just defined as:
fromRational = pure . fromRational
So it's the same thing.
> I am noticing this, because when I compile a netwire test program with
> haste, the first code segment fails during runtime because of the
> primOp newByteArray#.
Michael Snoyman has reported that Netwire 4 compiled fine using GHCJS.
Give that one a try.
Greets,
Ertugrul
--
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121003/dbe9ac66/attachment.pgp>
More information about the Beginners
mailing list