1,946 reputation
712
bio website
location
age 21
visits member for 2 years, 3 months
seen 8 hours ago

May
10
comment Object-Oriented Object Transformations
This answer is great!
May
10
comment Object-Oriented Object Transformations
I'm going to go ahead and say that the Object Orientation is almost certainly not the best choice here. Functional processing pipelines work far better in this kind of scenario. All that considered, Gregor's answer is excellent, and basically in line with what I just said.
Mar
10
comment How does persistence fit into a purely functional language?
The Query and Update monads are pretty far removed from IO, actually. I'll try to give a simple example in an answer.
Mar
1
comment How does persistence fit into a purely functional language?
Perhaps it would be helpful to look at the design of various persistence libraries in Haskell; in particular, acid-state seems to be close to what you are describing.
Feb
11
comment An alternative to an array of functions?
I think it's worth noting that you're basically creating a so-called "structural object" here, so any existing work on doing structural OO in PHP should be of help to you.
Jan
25
comment Why doesn't Haskell have a 'format' function for string interpolation?
You can also use shakespeare-text, which may be of interest to you.
Nov
1
comment Non-trivial functions that operate on any monad
Just to note, your bindFold is normally called sequence, and can be made generic over all Applicatives, not just Monads. The same goes for the more general version traverse.
Oct
5
comment Functional programming and stateful algorithms
@bigstones Perhaps this library will be helpful to you?
Oct
5
comment Functional programming and stateful algorithms
@Philipp I disagree. An automaton or state machine is sometimes the most natural and accurate way to represent a problem, and functional automata are well studied.
Oct
4
comment Functional programming and stateful algorithms
I, for one, would love to see the code that you've been trying to work with. In the absence of that, my best advice is that Haskell's laziness can often be exploited to not compute things more than once. Look into so-called "tying the knot" and lazy value recursion, although your problem is likely simple enough that the more advanced techniques that take advantage of infinite values and similar things would be overkill, and would probably just confuse you right now.
Sep
30
comment What can Haskell's type system do that Java's can't and vice versa?
@AndresF. I wouldn't call it a syntactic difference, but it's not a type system difference, more of a standard library difference. Java could easily (well, "easily") have chosen to use some kind of effect-tracking system, since it's type system is already powerful enough to handle it.
Sep
30
comment What can Haskell's type system do that Java's can't and vice versa?
@DarkOtter I'm aware of Typeable, but Haskell 2010 does not have it (maybe Haskell 2014 will?).
Sep
30
comment What can Haskell's type system do that Java's can't and vice versa?
@awashburn Thanks! This is fixed now.
Aug
14
comment “Everything is a Map”, am I doing this right?
@LieRyan Monads in general actually have nothing at all to do with mutability or globals; only the State monad specifically does (because that's what it in particular is designed to do). I also disagree that the State monad is not useful in a language with mutability, although an implementation relying on mutability underneath might be more efficient than the immutable one I gave (although I'm not at all sure about that). The monadic interface can provide high-level capabilities that are not otherwise easily accessible, the stateBind combinator I gave is a very simple example of that.
Aug
14
comment “Everything is a Map”, am I doing this right?
@tieTYT I think the pattern itself is a very good idea; the State monad in general is a useful code-structuring tool for pseudo-mutable algorithms (algorithms that are immutable but emulate mutability).
Aug
4
comment What is the difference between a Future and a Promise?
-1 They are not the same in Akka at all.
Jul
17
comment In-memory datastore in Haskell
When you say "an in-memory datastore", do you mean something like acid-state?
Jul
3
comment What's so useful about closures (in JS)?
@Giorgio In fact, that's how closures in most languages are actually implemented! That doesn't change the fact that not having to pass such an object around explicitly makes a huge difference to code clarity, not to mention making refactoring much more uniform because you don't have to worry about how you're going to get access to the enclosed state.
Jun
14
comment Is Haskell function composition an instance of pipe & filter architectural pattern
@AndresF. The category of Complete Partial Orders.
Dec
13
comment What's the difference between syntax and semantics?
@KeithThompson Actually, in theory, a compiler or interpreter for a language with a sufficiently strong and powerful (i.e., dependent) type system can check any arbitrary property of your code (modulo the Halting Problem, if applicable), so breaking semantic errors into "checkable" and "uncheckable" doesn't really make sense in general.