[Haskell-cafe] Odd behavior with Num instance for lists (was: f^n for functional iteration)
danburton.email at gmail.com
Fri Dec 13 18:57:10 UTC 2013
When using this hack, I prefer `fromInteger x = repeat (fromInteger x)`.
That way, you get
> 2 * [1,2,3]
It's cute for playing around, but the Num instance for lists is somewhat
discouraged in "real" code.
-- Dan Burton
On Fri, Dec 13, 2013 at 10:15 AM, Dario Bertini <berdario at gmail.com> wrote:
> I guess you meant
> (*) = zipWith (*)
> Dumb question: would it be fine to use such an instance in real world
> application code (in contrast with library code... I guess it would be
> frowned upon there?)
> are there any "dangers"... weird interactions?
> xmpp: berdario at gmail.com
> bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
> gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
> for signing commits)
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe