T
Tony Morris
blog.tmorris.net · Personal blog · on HN since 2007
Tony Morris, a Scalaz contributor, writes about functional programming, Scala, Haskell and Java, often in a combative style.
What HN saysHN commenters link his exercises on Haskell lifting and applicative functors as learning material for functional programming concepts.
30HN people shared it
13linked it in comments
27stories submitted
198story points
4 months agolast shared
2007people per year2026
Most-shared posts
- 1Scalaz lead developer: Critique of oderskys scala levels3 people · 3 points · first shared 2011 · discussion on HN
- 2Java is pass by value2 people · 2 points · first shared 2011 · discussion on HN
- 3Sticks, stones, but names are not useful to me2 people · 1 points · first shared 2013 · discussion on HN
- 4Three and a half friggin years later2 people · 1 points · first shared 2011 · discussion on HN
- 5Reverse.jar1 people · 50 points · first shared 2010 · 39 comments on HN
- 6Understanding Practical API Design, Static Typing, and Functional Programming1 people · 48 points · first shared 2011 · 26 comments on HN
- 7Why are there no big applications written using functional languages?1 people · 15 points · first shared 2010 · 29 comments on HN
- 8Dear Java library guy1 people · 15 points · first shared 2010 · 8 comments on HN
- 9Java 71 people · 14 points · first shared 2011 · 4 comments on HN
- 10Never ever again1 people · 7 points · first shared 2008 · 3 comments on HN
- 11Idempotence versus Referential Transparency1 people · 6 points · first shared 2013 · discussion on HN
- 12Java/Ruby does not generalise to static/dynamic1 people · 5 points · first shared 2008 · 1 comments on HN
- 13What you call integration testing, I call sloppy programming1 people · 5 points · first shared 2008 · 5 comments on HN
- 14Tests as Documentation1 people · 4 points · first shared 2008 · discussion on HN
- 15Why Functional Programming Matters in short prose1 people · 4 points · first shared 2011 · discussion on HN
What HN people wrote when they linked it
asgard1024 · 2013-10-21
> That said, it isn't hard or long to learn monads.
I am not sure any definition does that justice. It's similar with concept of recursion - it's easy to define (function calls itself), but to put it into programming practice (writing all loops as recursion), that's a lot harder.
I read "Learn Yourself a Haskell" as a tutorial (which is in my opinion great) and still it was a lot of work to figure out this: http://blog.tmorris.net/posts/20-intermediate-haskell-exercises/
Then I started reading http://www.haskell.org/haskellwiki/All_About_Monads but didn't finish it yet (I was playing with Haskell, just figuring out how to structure the application). IMHO, unless you understand all that, how to put monad concept into practice, you don't really know monads.
gtani · 2011-11-07
relevant exercises from one of scalaz' authors
http://blog.tmorris.net/lifting-haskell-addendum/
http://blog.tmorris.net/lifting/
and the applicative functor and following chapters in Learn you a Haskell (it wasn't real easy to navigate scaladocs, source, etc. Some folks used to just hoogle and then look for the same-named scalaz method
http://groups.google.com/group/scala-user/browse_frm/thread/2e93b614df…
and the scalac switches -explaintypes, -Ytyper-debug are kinda helpful.
throwaway81523 · 2026-07-10
> Your wording sounds like it implies that Lisp "got stuck" somewhere in the past, no?
Pretty much. See pg's famous "Blub Paradox" where he sees Lisp as the top of a tower of lesser languages. He doesn't recognize that Lisp might at best be called a limit ordinal, to use math jargon. That is, Lisp is just another Blub, and the Lisp zealots haven't figured that out.
You don't necessarily want to keep going further and further up, of course. Lisp still has fascination. But e.g., in Common Lisp (I mean just the stuff in the CL spec, no ad-hoc extensions allowed) you can't write anything resembling an OS. You can in Scheme, using continuations to handle process switching.
Going further up, Lisp doesn't make it easy to ensure the absence of particular behaviours in a program, what TAPL calls the purpose of a type system. Tony Morrison has a semi-realistic example of what static types can get you:
http://blog.tmorris.net/posts/understanding-practical-api-design-stati…
Link still works but TLS certificate expired in 2025, tsk tsk.
crntaylor · 2012-10-19
I don't think you can refer to function composition as a design pattern. The syntax for function composition in Haskell is so light that most of the time it's more effort to write in all the arguments explicitly than it is to use composition. Consider
lineLengths = map (length . words) . lines
as compared to
lineLengths text = map length (map words (lines text))
I don't think that monads are a design pattern either (in this I agree with Tony Morris [1]). Monads are a unified method of doing contextual computations. They are far too general to be a design pattern in themselves (how many design patterns do you know that encompass failure, error handling, nondeterminism, probabilistic computation, logging, backtracking search, mutable state, asynchronous computation, continuations, I/O...)
Monads should be more accurately thought of as an interface that is implemented by many types (in Haskell terminology, a class that many types are instances of).
I am not saying that there aren't any design patterns in Haskell - just that function composition and monads are not examples of design patterns. Instead, common design patterns include
* Writing tail-recursive, accumulating helper functions where you'd use a for loop in an imperative language:
sum xs = go 0 xs
where
go result [] = result
go result (x:xs) = go (result + x) xs
* Using strict left folds to accumulate values
sum = foldl' (+) 0
* Using runStateT and its cousins to tame…
dxbydt · 2011-11-17
I recently (well, a few years ago) went through functional programming in schools. They don't really teach you functional programming, as much as why you shouldn't program imperatively. Even when they're teaching functional programming, the consistent emphasis on only x% effective really cuts out student interest. It's almost like saying, "yeah we have a method for preventing destructive assignment, but it doesn't really work." While it might seem like a good idea at first, I found it to quickly invoke the I'm not listening anymore response.
Next, is the issue of effectiveness. Personally, I've been shown way so many gross images of imperative spaghetti code, that I won't even open vim without knowing I have scala. Unfortunately, this doesn't follow through for a lot of other kids who went through the same education as I did. "I love ruby", "what about python", "it doesn't feel as good as C++", and "it's just too much work" are all (yes I know it's sad) frequently cited responses among people I know.
Thirdly, and most troublesome of all, some people don't care that they're spreading nasty interoperability impedance mismatching in their non-scalaz libraries since they haven't realized that variance annotations are not worth their use in the context of Scala’s partial support for Hindley Milner type-inferencing.
. I recently found out someone I knew was receiving treatment for coding in C. I asked her when she found out, believing this to be a recent development. "I've been…
DavidMcLaughlin · 2011-06-22
Most of the complaints I see from Java programmers amount to this:
http://blog.tmorris.net/anti-intellectual-euphemisms/
Specifically:
> using the word complex, unnatural, academic, “your world” or unintuitive to mean “I am not able nor am I willing to invest the effort to come to to understand this.”
Other than those people:
The blog author I quote above is one of the many "PL gurus" you speak of that rip into Scala because of its various deficiencies when compared to the likes of Haskell. The ones I am smart enough to understand mostly revolve around the type inference and type erasure problems. You mentioned those but I have already run into issues where I did care about them so I don't think its fair to dismiss them as you did.
The amount of hyperbole that comes from elements of the Scala community on actors I think is a cause of a fair amount of vitriol, mostly because actors are not a silver bullet and come with their own host of problems. Akka is trying to solve some of those problems of course :)
And of course the lack of tools. It's hard for me to talk about this because I loathe IDEs. So far I have been writing my medium sized project entirely in vim + NERDTree and it's been great. I imagine with enterprise scale projects I would start to miss Eclipse though.
catnaroek · 2016-08-23
The Liskov substitution principle always holds in a type-safe language with subtyping. What is failing isn't the LSP, but rather your expectations from types. Just because a type is called “Rectangle”, it doesn't mean its instances actually behave like rectangles.
See: http://blog.tmorris.net/posts/identifier-names/index.html
lliamander · 2015-09-21
You can have a type-safe fluent Builder, but it requires having one or more static nested classes with private constructors. The outer class will not have a build() method, but rather that method will live in one of the nested classes. You use the type system to control what parameters have already been set, and what parameters need to be set.
Obviously, this can apply to many sorts of fluent API. This is at least part of what Tony Morris is alluding to in his essay on API design [1].
[1] http://blog.tmorris.net/posts/understanding-practical-api-design-stati…
mgurlitz · 2012-05-06
The author conflates quite a few unrelated concepts. Monads with "interfaces and object models," and templates with type inference. Perhaps in the programmer's head these all serve similar functions (often erroneously. See, e.g. http://blog.tmorris.net/type-classes-are-nothing-like-interfaces/), but language designers need to make clearer distinctions.
pufuwozu · 2011-04-30
You might be right, I've interacted with him very little online.
On the other side, you should read the blog post he put up an hour ago (possibly in response to this thread):
http://blog.tmorris.net/three-and-a-half-friggin-years-later/
PS: This is why I sometimes demonstrate low tolerance for stupidity and/or failure or refusal to entertain the possibility of thinking. People get hurt. No, I am not sorry.
(for context he is very good at squash and hurt himself while playing)
eru · 2010-07-01
That's a shame. And I agree. I guess the author should provide translations in C or Java or whatever along with his examples as far as possible. I understand his Haskell examples, but that's preaching to the choir.
I read a blog post were somebody re-implemented some examples of Haskell concepts in C. I can't remember the URL, but searching for "Monads in C" or "Monads in Java" etc brings up some interesting posts. E.g. http://blog.tmorris.net/maybe-monad-in-java/
jsa · 2008-06-10
I might consider taking this way:
“My 6 year old son is learning computer programming by first understanding the mathematical foundations, then applying what he has learned using Haskell, because it is short and natural (he doesn’t even know what Haskell is)”
http://blog.tmorris.net/does-java-cause-self-delusion/