5 ms·
i know this is a haskell thread but after trying to grok haskell for years (yes i understand monads) i've discovered F# and jesus christ what a dramatic differe
by mlevental 9y ago
i know this is a haskell thread but after trying to grok haskell for years (yes i understand monads) i've discovered F# and jesus christ what a dramatic difference in functional language ergonomics and tooling and ecosystem. it has everything that haskell does (ADTs, type inference, immutability [when you want it], lazy [or eager] eval, pattern matching/destructuring, expression based, and partial application/curried functions) but it doesn't handcuff you to pure (side-effect free) code. say what you want but often writing code in haskell is monad acrobatics because you can't write a simple for loop or do i/o. the tooling is fantastic and cross platform (visual studio/xamarin) with a real debugger, real breakpoints, lightyears better docs, readable compiler errors, enormous ecosystem by way of interop with c# libraries. it's an eminently practical functional language. the `F# for fun and profit` series of blogposts is fantastic for not only introducing the language but explaining the value proposition of functional patterns. of course i wish ocaml had the same advantages (and it does have many) since it compiles to native binary but i'll accept the CLI in exchange for all the tooling benefits.
- bad_user 9y agoOn Hacker News I've noticed people read titles, then go to the comments section to dump whatever thought is on their minds, triggered by certain keywords like some game I used to play as a child, as an excuse to get something off their chest. It's very rude to pimp on other people's projects and articles to get something off your chest though. This article is not primarily about Haskell, but about a commercial IDE made by a guy named Manuel M T Chakravarty — which for me it's interesting, because it's an example of somebody that apparently makes something that he likes, helping an ecosystem and people give him money for it. So it's perfectly on topic for Hacker News and visitors of the comments section like myself, would like to see opinions related to this project. As for the comment, F# is a fine language, but reading the comparison I'm fairly certain that you haven't learned Haskell and I say this in order to help you — learning Haskell is the easiest path to practicing FP, which given your comment I'm fairly certain you don't grok yet, which keeps you back from being a good F# developer as well. That you haven't learned Haskell is more of a failure of Haskell's community — but there have been recent projects trying to address that. One is the Haskell for Mac project here in TFA, others are the Stack build tool and http://haskellbook.com http://haskellbook.com, a really good book meant for beginners.
- hellofunk 9y ago> Haskell is the easiest path to practicing FP Have to disagree here. Haskell is good for learning about advanced type systems along with FP. But for the "easiest" path to just learning FP, Scheme, SML, even Clojure are far more approachable.
- deleted 9y ago[deleted]
- mlevental 9y ago>It's very rude to pimp on other people's projects and articles to get something off your chest though. this isn't a refereed journal - you can't prescribe how people engage with the material. i was prompted to post what i did on the back of having experimented with every ide-ish thing for haskell out there about 6 months ago (this one included). >As for the comment, F# is a fine language, but reading the comparison I'm fairly certain that you haven't learned Haskell and I say this in order to help you not only is this patronizing but it commits the fallacy of begging the question - i did learn haskell while working on a fairly sizable codebase at my last job. i won't reiterate all of my complaints here (i've posted several times to r/haskell) but the tooling sucks and pure code is a set of handcuffs - golden handcuffs maybe but handcuffs nonetheless. that we disagree on whether pure code is the one true god does not mean i don't understand fp - it means just that, that i disagree! to conclude from my disagreement with you that i don't understand fp begs the question (petitio principii) of whether pure code is the one true god. >That you haven't learned Haskell is more of a failure of Haskell's community — but there have been recent projects trying to address that. One is the Haskell for Mac project here in TFA, others are the Stack build tool and http://haskellbook.com http://haskellbook.com, a really good book meant for beginners. i read the haskell book and learnyouahaskell and real world haskell and many many tutorials and wrestled with stack and cabal. certainly they're better than the tools/resources available for e.g. cobol but they do not compare to the ecosystem around other, much more welcoming languages.
- axlprose 9y agoI think part of the issue that the parent comment was trying to get at here, is that haskell does things the way it does for a reason, and that the type system is much more of an aid to thinking about the problem you're solving than some restrictive handcuff, once you understand what it's doing and why it's doing it. I say this as someone who worked in F# for years, and eventually switched to haskell because it had better support for these concepts via it's built-in typeclasses. As for what you say about haskell being "monad acrobatics", it can be equally true of F#, or any other typed functional language, because all monads/applicatives/functors/etc are, are just helpful functional design patterns. It would be like calling Factories in Java handcuffs. If you don't want to code using Factories or Monads in Java/Haskell, that's still your choice, but if a lot of libraries in that language are using that pattern, it's probably for a reason that makes it useful in that language's paradigm. Haskell just makes it easier to use these patterns than F#/OCaml/Elm/etc because of its typeclasses, so a lot more people use them. That's all there is to it. I'll grant you that F#'s tooling is a little bit better in places though, but I was never a huge fan of it's project/module system. OCaml probably has both F# and Haskell beat there. That being said, F# is still a fine language, and I think it's probably a better stepping stone towards learning haskell (and typed functional programming in general) than haskell itself, just because it gives you the option of gradually easing your way into the ML style of programming if you've already had some imperative programming experience before. And that's key, because the issue here is one of shifting the way you think about your programming problems, and there's simply no quick/easy way to do that. In fact, I find that a lot a complete newcomers to programming have an easier time learning how to do things the haskell way, because they don't really have these issues of feeling restricted by the type system, since it's the only way they've been taught to do things. So overall I would say just keep at it with F#, and check out the F# way of doing things like monads (or "computation expressions" [0] as they're called in F#) , monoids [1], "Railway Oriented Programming" [2], and other such patterns [3], then maybe try checking out Haskell again later and see if it seems a little easier. But there's really no reason to be bashing it regardless. [0] https://fsharpforfunandprofit.com/series/computation-expressions.html https://fsharpforfunandprofit.com/series/computation-express... [1] https://fsharpforfunandprofit.com/posts/monoids-without-tears/ https://fsharpforfunandprofit.com/posts/monoids-without-tear... [2] https://fsharpforfunandprofit.com/rop/ https://fsharpforfunandprofit.com/rop/ [3] https://fsharpforfunandprofit.com/series/map-and-bind-and-apply-oh-my.html https://fsharpforfunandprofit.com/series/map-and-bind-and-ap...
- kccqzy 9y agoIf you think writing code in haskell is monad acrobatics, you don’t grok monads.
- deleted 9y ago[deleted]
- andreasgonewild 9y agoAnd if you think monad transformers are the answer to anything, maybe you should let go of your books and try some real problems for a change. I spent several years digging into Haskell; but in the end I couldn't shake the feeling that it's more about mental masturbation than practical problem solving, which is fine if that's what you're looking for. Even the poster child feature of GHC, Software Transactional Memory; is barely usable outside of neat tricks and toy problems.
- mlevental 9y agoalternatively if you think writing haskell isn't monad acrobatics then you haven't written i/o heavy code.
- jeremyjh 9y agoI’ve written more than 40,000 lines of I/O heavy code. I had a phase where I felt this way, but really it is a learning issue and you get passed it.
- virtualwhys 9y ago> but really it is a learning issue and you get passed it. No wonder, all this time I've been thinking that with enough practice I'll finally grok monads, but no, one simply has to wait for the pass to be on target. SPJ, hit me in the numbers!
- jernfrost 9y agoSee that is why I eventually decided against Haskell. There are just too few Haskell jobs so investing that amount of time from a career perspective makes little sense. That leaves hobby projects. And it just does not seem to make sense to me to spend that much time on a hobby, when you got plenty of other powerful languages you can learn in a fraction of the time and do more useful stuff with. As an academic project language it seems great, but for practical work I just don't see it. I can do a fair amount of functional programming in Swift and Julia, but still make useful stuff without without an huge mental investment. My life as a professional C++ programmer has made me very negative to anything involving unreasonable complexity.
- danidiaz 9y ago> you can't write a simple for loop or do i/o. You can often use the "for" function for things analogous to effectful imperative loops. http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Traversable.html#v:for http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-T...
- PhineasRex 9y ago> you can't write a simple for loop or do i/o for [1..10] print Trivially refuted.