maradydd: (Default)
[personal profile] maradydd
  • Maybe is the same thing as Kleene ? (the "zero or one" operator in regular expressions).
  • A typeclass is the same thing as an STL concept, but a typeclass actually means it.
  • instance means "We're going to make this data type an instance of this typeclass, and here's how."
Now if I can just get my head around monads, I'm set.

(no subject)

Date: 2009-07-30 10:34 pm (UTC)
From: [identity profile] neoliminal.livejournal.com
Haskell scares me. In the same way that someone showed me you could make the number "1" into a function in Python. Although it's very entertaining that you can define a variable as infinity and only use the parts of infinity that you need at a given time.

(no subject)

Date: 2009-07-31 06:19 am (UTC)
michiexile: (Default)
From: [personal profile] michiexile
Oh, but making numbers, or constants in general, into functions is very much in line with the underlying mathematics of functional programming.

An element of an object in a nice category - say, for instance a data type in an appropriate category of data types and computable functions - is a computable function from the terminal object (to which there is one unique map from every other object) to your object.

So, in Haskell terms, an element is just a 0-ary function
1 :: () -> Int
and then the compiler is gracious enough to give us syntax sugar for 0-ary functions.

(no subject)

Date: 2009-07-30 10:59 pm (UTC)
From: [identity profile] allonymist.livejournal.com
Monads are weird. I can use them so long as I'm not thinking about how they work, and I can understand how they work so long as I'm not trying to use them.

(no subject)

Date: 2009-08-01 03:20 pm (UTC)
From: [identity profile] alexey-rom.livejournal.com
See the paper "A comparison of C++ concepts and Haskell type classes": http://publications.lib.chalmers.se/cpl/record/index.xsql?pubid=72479

(no subject)

Date: 2009-08-02 06:25 pm (UTC)
From: [identity profile] maradydd.livejournal.com
Thanks! That was a fun paper.

(no subject)

Date: 2009-08-03 03:08 am (UTC)
From: [identity profile] oddthink.livejournal.com
Haskell is fun, but it takes some work to understand all the type classes. Have you seen the "Typeclassopedia" by Brent Yorgey? It helped me wrap my head around some of the abstractions.

even the greeks had trouble with monads

Date: 2009-08-03 03:03 pm (UTC)
From: [identity profile] mohats.livejournal.com
http://en.wikipedia.org/wiki/Monad_(Greek_philosophy)

so don't feel bad :-)

(no subject)

Date: 2009-08-04 07:32 pm (UTC)
From: [identity profile] m4dh4tt3r.livejournal.com
How long have you been coding in haskell? I just started picking it up this week. I have experience with other functional languages, so a lot of the fundamentals are there. My motivation to pick up haskell is that our core developers where I am working is really into functional programming; one of the components we're developing is written in scheme.

(no subject)

Date: 2009-08-04 07:35 pm (UTC)
From: [identity profile] maradydd.livejournal.com
Almost exactly a week. I learned Common Lisp back in grad school, and I tend to write Python and (god help me) C++ in a fairly functional style, so I'm in the same boat as you. I'd been wanting to pick up Haskell for a while, and a friend and I decided to collaborate on a project in it. He's more experienced at it than I am, so he's been a very helpful guide.

? is not Maybe

Date: 2009-08-08 08:43 pm (UTC)
From: [identity profile] davidsarah.livejournal.com
"Maybe is the same thing as Kleene ? (the "zero or one" operator in regular expressions)."

Nope. The types are significantly different. Kleene ? operates on sets of sequences; Maybe is a constructor for a discriminated union:

extension(T?) = extension(T) union {[]}.
extension(Maybe T) = {Some t | t in extension(T)} union {Nothing}.

This is not just nitpicking, honestly :-)

(You seem to have typeclasses right.)

Profile

maradydd: (Default)
maradydd

September 2010

S M T W T F S
   1234
567891011
12131415 161718
19202122232425
26 27282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags