6 ms·
Try Haskell
Edit: I'm not the creator of this, I just saw it on programming reddit and thought it would interest people here. With that said, if you want to give feedback to the creator, there would be a better place: http://www.reddit.com/r/haskell/comments/b58rk/try_haskell/
- gphil 17y agoCool! I really like what the Haskell community is doing lately to reach out to new users. As someone who didn't know anything about functional programming a year ago, I can say that I've learned a lot just by messing around with it a little bit.
- giu 17y agoSame here. I can only recommend to learn you a functional programming language for greater good. I love every minute I spend writing Haskell code, be it a simple console application or something more complex. It's really fun, interesting and educational, and I'm only at the beginning :)
- nym 17y agoNice, but needs more steps... get me to the point where I understand what a Monad is, because I really want to know!
- dmnd 17y agoExactly, multiplying two numbers and reversing a string aren't what got me interested in Ruby. TryRuby was an absolutely frictionless way to learn the basics because it had a few lessons built in. I'll be back to this site in a few weeks to check for progress...
- derefr 17y agoI think the reason I've avoided getting into Haskell is that it seems like, no matter what tutorials or references I read on it, I never make it any further into http://www.willamette.edu/~fruehr/haskell/evolution.html http://www.willamette.edu/~fruehr/haskell/evolution.html before I completely lose track of what's going on. Haskell seems like it has all the same stuff as most other languages, but then there's this whole other layer of knowledge (mostly mathematical problem-domain knowledge) you have to add on before you can actually claim to "know" Haskell. I'm always hoping there'll be a tutorial that covers that sort of stuff, instead of just saying "here's how to do in Haskell the stuff you already know how to do in Ruby."
- noamsml 17y agoI think YAHT is sorta decent in that regard. In the fourth chapter it teaches you enough to do something, and then it ramps you up a bit. It's still really confusing, but it's better than usual.
- jerf 17y agoI am not sure, but it's worth checking: You do know that link is a joke, right? "Senior Haskell programmer" is where reality stops (give or take an entry or two, not counting the last "tenured professor" one), and if you can't get "foldr" you're ill-equipped to deal with more advanced Javascript techniques either.
- derefr 17y agoYeah, I'm aware that the whole point of it is the needless complexity of the latter solutions—still, you have to know Haskell to understand exactly why the latter solutions are so ridiculous (beyond merely gawking at them unappreciatively) and you have to understand Haskell even better to actually come up with the penultimately-contrived solutions. I'd like to be able to tell those jokes without it being like making sounds in a foreign language—that's what I mean by "knowing" Haskell. You can't speak a language until you can make a witty retort in it ;)
- dons 17y ago> all the same stuff as most other languages, but then there's this whole other layer of knowledge (mostly mathematical problem-domain knowledge) you have to add on before you can actually claim to "know" Haskell. That's just computer science -- a bunch of CS stuff is easier to express in Haskell, so we do, but it might need some background. > here's how to do in Haskell the stuff you already know how to do in Ruby Try a different tutorial. Maybe: Real World Haskell?
- jmillikin 17y agoI don't understand how people keep failing to understand monads. Maybe it's the line noise operator `>>=' ? Lets define a simple type, `Maybe', which can store either a value or an absence of value: data Maybe a = Just a | Nothing deriving (Show) And define a function which compares a number against a limit, and returns `Nothing' if the value is out of range: clamp :: Ord a => a -> a -> Maybe a clamp limit x = if x > limit then Nothing else Just x Easy enough. Now, how should the number be compared against multiple limits? One way is to just brute-force it: multiclamp :: Ord a => a -> a -> a -> Maybe a multiclamp lim1 lim2 x = case clamp lim1 x of Nothing -> Nothing Just x' -> clamp lim2 x' But this is ugly. Lets use monads to simplify it. First, take a look at the core Monad operations. I'm going to use `build' and `bind' instead of `return' and `>>=', because they're probably more familiar to most readers. class Monad m where build :: a -> m a bind :: m a -> (a -> m b) -> m b Next, we'll define an instance of the `Monad' typeclass for `Maybe'. It will use the same semantics as the `multiclamp' example -- that is, if the first test returns `Nothing', the entire computation will return `Nothing': instance Monad Maybe where build x = Just x bind Nothing _ = Nothing bind (Just x) f = f x Using this definition, `multiclamp' can be written thus: multiclamp2 :: Ord a => a -> a -> a -> Maybe a multiclamp2 lim1 lim2 x = bind (clamp lim1 x) (\x' -> clamp lim2 x') Although ugly, this notation is sufficiently generic that the compiler can generate it from an imperative notation. Lets look at two more examples. First, `multiclamp2' written using "real" monads. Notice that this is exactly the same as before, except `bind' is an operator named `>>=': multiclamp3 :: Ord a => a -> a -> a -> Maybe a multiclamp3 lim1 lim2 x = (clamp lim1 x) >>= (\x' -> clamp lim2 x') And finally, using the imperative-style `do' notation. Note that although this is imperative, it is not impure -- this is semantically equal to `multiclamp3': multiclamp4 :: Ord a => a -> a -> a -> Maybe a multiclamp4 lim1 lim2 x = do x' <- clamp lim1 x clamp lim2 x' This is, obviously, a superficial example -- you'd never see such verbose code in code written by an experienced programmer. But the verbosity helps to visualize what the compiler is doing. For completeness, here's a "cleaner" version, which takes advantage of currying and the combinator `.': multiclamp5 :: Ord a => a -> a -> a -> Maybe a multiclamp5 lim1 lim2 = (clamp lim2 =<<) . clamp lim1
- deleted 17y ago[deleted]
- jackowayed 17y agoTotally agree. Try ruby isn't great because it's a ruby shell in your browser. It's great because it's a ruby shell in your browser that shows off many features of the language. By the end, though people are definitely still beginners, they have a decent handle on the syntax and many of the basic objects. More than just multiplying numbers and reversing a string.
- simplify 17y agoThe text area scrolls to the very top every time I type, not letting me see what I type [Safari 4.0.3] Pretty cool app. A tutorial to go along with it would do wonders.
- mhansen 17y agoAlso in Chrome 5.0.322.2 dev
- Ezra 17y agoI applaud the effort, but this is far from complete. As far as I can tell, you can only do standalone expressions, to the exclusion of anything interesting. Type Haskell expressions in here. > let x = 10 not an expression: `let x = 10' I understand that mueval has this limitation too? It's more defensible in the irc context that "state" would be disallowed. Here, it's just crippling. I don't need the mtl stuff, but being able to define a basic function would be nice! http://codepad.org/ http://codepad.org/ will run full programs for you ... I guess that'll continue to be my tool of choice for online Haskell prototyping. Still, this project does seem promising.
- jerf 17y agoThe developer posted on Reddit that this was a premature release. (Clarification: That is to say, he did something like email the link to a buddy and it unexpectedly ended up on Reddit, not that it was formally released and then regretted.) To be honest, if you're at the point where you want that sort of thing, I'd generally suggest simply downloading ghci. ISTM that all these "try it online" things are good for are making the decision of whether you want to bother with that step. (Perhaps I'm spoiled on Linux where downloading GHC or Ruby is hardly any harder than visiting a web page anyhow.)
- sethg 17y agoYou can at least do this: > let x = 10 ; y = 5 ; in x + y => 15 :: (Num t) => t
- munctional 17y agoDoes anyone have any suggestions for beginner Haskell projects? I've read through some Haskell material before and tried following tutorials, but I always end up dropping it because I can't think of anything for which I would use it. I have no problem with functional and functional-esque programming (Erlang, Common Lisp, etc.), but I just can't come up with anything to do in Haskell. :( EDIT: Thanks for the great suggestions, everyone! I think I'll do some crpyo-based maths work in Haskell since that is what holds my interest at the moment. :-)
- dons 17y agoSomething with lots of threads.
- smikhanov 17y ago...with STM thrown inside (an in-memory DB?)
- lg 17y agoI usually start picking up new languages by taking something I've written and translating it into the new language.
- brianobush 17y agoexactly my approach, also you can try college homework assignments found via google.
- christopherdone 17y agoThat's a good way to see if the language actually helps you do things easier, too!
- scorciapino 17y agoInstall xmonad and configure it properly
- 17y ago
- baguasquirrel 17y agoPretty nifty. Needs import though, so you can do stuff like: :m + Data.List intersperse '.' "hello" And anything else you'd need if you want to use stuff other than just the Prelude.
- jedbrown 17y agoMany modules are already imported, including Data.List.
- baguasquirrel 17y agoPretty nifty. Needs import though, so you can do stuff like: :m + Data.List intersperse '.' "hello" And anything else you'd need if you want to use stuff other than just the Prelude.
- baguasquirrel 17y agoPretty nifty. Needs import though, so you can do stuff like: :m + Data.List intersperse '.' "hello" And anything else you'd need if you want to use stuff other than just the Prelude.
- baguasquirrel 17y agoPretty nifty. Needs import though, so you can do stuff like: :m + Data.List intersperse '.' "hello" And anything else you'd need if you want to use stuff other than just the Prelude.
- jashkenas 17y agoAh, but can it reverse an infinite list? > reverse [1..] Time limit exceeded
- cool-RR 17y agoPlease add help for something beyond "beginners".
- binarycheese 17y agoVery impressive