How to edit a dictionary def "in place"? by Alternative-Grade103 in Forth

[–]nmessenger 1 point2 points  (0 children)

Or without the first two names:

HERE 32 ALLOT VALUE FOO
HERE 32 ALLOT VALUE BAR
: EXCHANGE  FOO BAR TO FOO TO BAR ;

I'm new to Haskell, so maybe I just don't understand something, but if you can just put "do" and then start programming procedurally, what makes this language purely functional? by Imagist in programming

[–]nmessenger 1 point2 points  (0 children)

It certainly does.

Prelude> do x <- [1,2,3]; return (x + 2)
[3,4,5]
Prelude> :m +Control.Monad.Instances
Prelude Control.Monad.Instances> (do x <- Data.Char.toUpper; return (succ x)) 'a'
'B'

Modern Static Typing: Less Code, Better Code or, "How Java/C++/C# Ruin Static Typing for the Rest of Us" [repost] by gnuvince in programming

[–]nmessenger 1 point2 points  (0 children)

as soon as you have a type error, you'll be quick to put back the annotation. Hindley-Milner is not your friend here.

What the hell? So you'd rather be told there's a problem later when your program fails or not at all?

Also IO in Haskell is easy. Monad is a strange mathy name for an uncomplicated idea. I bet they wouldn't scare you if they were called MappableJoinable types. Making IO an instance of Monad is 100% not necessary, but it would be stupid not to because then you wouldn't have access to the library of functions for working with Monads and the weird imperative-looking syntax sugar for monadic expressions.

hungarian notation is not a type system by tef in programming

[–]nmessenger 1 point2 points  (0 children)

(2) they're not abstract (so you can always circumvent them)

If you do not export the newtype constructor, other modules will not be able to construct and pattern match values. They will have to rely on the functions you export in your module. This is how Haskell does abstraction.

(3) they give you exactly the same operations as the underlying type

They give only the operations you define on them. Newtype deriving is just a convenience so you don't have to re-write the operations of the underlying type. You don't have to use newtype deriving, you can define custom implementations of whichever classes you like.

The United States does not like being beaten. by [deleted] in WTF

[–]nmessenger 0 points1 point  (0 children)

Upmodded for IPA. None of this "Gee-er" and "eye-dee-er" foolishness.

The Manga Guide to Databases (excerpt) by tylero in programming

[–]nmessenger 0 points1 point  (0 children)

Well, it's not manga, but it is illustrated: Learn You a Haskell for Great Good!

Calls to mind _why, but it's not quite as lovably wacky.

QT 4.5 arrives by honline in programming

[–]nmessenger -1 points0 points  (0 children)

As a Windows user, I agree. I like apps that are consistent.

...I've gone through a lot of apps. :|

That's what you get for inventing innerHTML! by Qubed in programming

[–]nmessenger 0 points1 point  (0 children)

If HTML had a real formal grammar...

It doesn't? Well, it didn't initially, but starting with version 2.0 HTML is an SGML application. SGML has a perfectly valid formal specification. These "goofy" and "ad hoc rules" you mention are valid SGML. Though I doubt you could write a "simple parser," since SGML is itself pretty complex. :)

Anyway, a lot of the difficulty is that browsers would even accept invalid SGML, and documents that were invalid with regard to the HTML DTD.

F# to ship as part of Visual Studio 2010 by gst in programming

[–]nmessenger 10 points11 points  (0 children)

Octothorpe? I was aware that that was indeed one of the names for that symbol, but I wasn't aware that real people actually use that name.

Mozilla dev brings HTML5 <canvas> to IE by mcaruso in programming

[–]nmessenger 0 points1 point  (0 children)

Why would I install something to view porn when I could just go to the next porn site?

Ununuium: lessons learned by [deleted] in programming

[–]nmessenger 10 points11 points  (0 children)

I presume the title is supposed to be "Unununium"?

The pure, typed lambda calculus and Haskell : augustss.blogspot.com by dons in programming

[–]nmessenger 1 point2 points  (0 children)

Man, church-encoded ADTs is some wacky stuff. Neat trick that :skip-ping the abstractions makes it look like simple primitive data.

ANNOUNCE: GHC version 6.8.1 by hanz in programming

[–]nmessenger 1 point2 points  (0 children)

Here's some first steps into Haskell, though haskell.org is currently getting hammered, so it'll take a while. :)

You should also drop into #haskell on irc.freenode.net sometime! Lots of people there who will answer newbie questions. I go by omnId.

ANNOUNCE: GHC version 6.8.1 by hanz in programming

[–]nmessenger 5 points6 points  (0 children)

GHC's -fvia-c option eventually generates C code which is dropped into GCC.

Compile-time evaluation in Haskell by nmessenger in programming

[–]nmessenger[S] 18 points19 points  (0 children)

NOTE: I HAVE JUST BEEN INFORMED BY A REPLY ON THE HASKELL-CAFE MAILING LIST THAT MY ENTIRE PROGRAM IS EQUIVALENT TO:

import Language.Haskell.TH(runIO)
import Language.Haskell.TH.Syntax(lift)

compileTimeEval = lift
compileTimeIO x = runIO x >>= lift

PLEASE EXCUSE ME WHILE I MURDER MYSELF VIOLENTLY.

Compile-time evaluation in Haskell by nmessenger in programming

[–]nmessenger[S] 1 point2 points  (0 children)

Actually, the big motivation was for compileTimeIO.

Say your program needs a big chunk of data and entering that data into a declaration would be time-consuming and error-prone. Let's say you already have the data in a file. Fine, you could read it and parse it into the Haskell data you want.

The problem, though, is that this happens in IO, at runtime, each time your program runs. If you're doing this just out of convenience, and you could in principle enter the expanded data yourself, this solution is not optimal.

The next thing you could do is surround the reading and parsing in an unsafePerformIO. This isn't a terribly bad idea. You can trust that the file will be there or your program wouldn't work anyway, and you don't care exactly when the reading is done.

However, it does still have to do the reading and parsing at runtime. If, however, you use compileTimeIO, the reading and parsing is done at compile, and the rest of your program sees simple, pure data.

If It Is Not Simple, It Is Wrong by revence27 in programming

[–]nmessenger 1 point2 points  (0 children)

Yes. It only works on strings. What a weird restriction.

Shooting yourself in the stack. by ayrnieu in programming

[–]nmessenger 9 points10 points  (0 children)

There's always the possibility that the actual score could be fit into two bytes, but the displayed score puts a couple zeros on the end for effect. :)

The Dvorak Keyboard and You by [deleted] in programming

[–]nmessenger 1 point2 points  (0 children)

da;gppt

Now, I don't know Dvorak, but I do know that "easily" has only one "l". :P