[Haskell-beginners] Netwire fromRational
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
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.
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...
Size: 836 bytes
Desc: not available
More information about the Beginners