5 ms·
Well, it sure looks nicer, I'll give you that. I'm more interested in the content, though. I was just trying here and there over the last week or so to learn s
by ufmace 12y ago
Well, it sure looks nicer, I'll give you that.
I'm more interested in the content, though. I was just trying here and there over the last week or so to learn some Haskell - people always seem to be raving about how cool it is. I found my way to the CIS 194 class link, the first one on the page, and I find that it really isn't very good for learning.
I went through the first page, trying to run some of the stuff. I find that the syntax of the ghci REPL seems to have almost nothing to do with the syntax shown so far. Apparently, I have to use let for every variable, which was never mentioned, and there are lots of funny tricks for how to use multi-line stuff. I still have no clue how to actually write something, compile it, and have some sort of output in the main ghc compiler. Is there a tutorial anywhere that actually helps you learn the language through doing useful things, instead of throwing a bunch of syntax that you can't do anything with at you?
Speaking of tutorials, the old page links to like 500 of them or so. I have no clue how to figure out which one to start with. If you're re-doing it, please link no more than 3 learning pages, no matter what. Have the rest in some buried page somewhere if you must, but keep the front page manageable. How is anybody supposed to make sense of however many tutorials and courses you guys have linked on the old one? I gotta figure I'm the prime audience for this stuff, but I have no idea where to start on your current page.
While I'm at it, can anybody recommend something like a step-by-step thing for people who are proficient in several other languages, but have never seen any Haskell before? Like where every little step has something you can actually type in, run somewhere, and get some sort of output?
- berdario 12y agoI suggest you enable the `+m` flag for multiline input This way, you don't have to use the weird curly braces trick (which I always forget), at the cost of having to type one more enter when entering a oneliner FYI, this is my ghci.conf: https://github.com/berdario/dotfiles/blob/master/ghci.conf https://github.com/berdario/dotfiles/blob/master/ghci.conf (I don't suggest a new user to use ClassyPrelude) That said, I'm not sure what learning material to suggest to you, but if google and stackoverflow.com fails you, try freenode#haskell personally, I got a lot more interested in Haskell after starting with Clojure (it helped me to appreciate more things like immutable data structures)
- ufmace 12y agoI've found that, when it comes to learning a new language from scratch, google and stackoverflow just aren't very helpful. Once you have the basics down, they're good for picking up extra bits and pieces, but at the beginning, when you have no idea where to even start, I find I need something a little more organized. I will try out that stuff for ghci.conf, though.
- PieSquared 12y agoYou could try IHaskell[0] for playing around with Haskell. It is like GHCi, but provides a notebook interface where you can enter multiline expressions and do declarations, so it is a lot closer to real Haskell. (It can be a bit of a paint o install though.) Disclaimer: IHaskell author here :) [0] https://github.com/gibiansky/IHaskell https://github.com/gibiansky/IHaskell
- deleted 12y ago[deleted]
- TimFogarty 12y agoIt sounds like you're looking for Learn You A Haskell. Great book, free too read online, tells you how to start with Haskell step by step. http://learnyouahaskell.com/chapters http://learnyouahaskell.com/chapters
- sparkie 12y agoI too dislike tutorials focused around the REPL, because it's rarely how you write code in practice. The REPL is more of a debugging tool for quickly testing and manipulating code you've already written. I'd jump directly into creating code files/modules - begin by creating simple programs using `main` as you would in other languages. Create a file with ".hs" extension, (Haskell filenames start with capital letters by convention, since they share the name of the module) main :: IO () main = putStrLn "Hello World!" Make sure the GHC bianries are in your PATH, and use the program "runhaskell File.hs" to quickly compile and execute them. Also, from ghci you can use the command (:load File.hs), if you want to debug stuff. The preferred tool for writing Haskell though is emacs. If you're not familiar with emacs, its also a great opportunity to learn. Grab emacs 24, and open the file ~/.emacs, paste in this snippet: (require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) (package-initialize) Then hit M-x (M for Meta, which is typically Alt), and type eval-buffer into the minibuffer at the bottom. If no errors, hit M-x and type into the mini-buffer: package-install haskell-mode You can add the following to the .emacs file and use `eval-buffer` again. Also save with C-x C-s. (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) Next step is to just open an empty haskell file. Create a new directory for your project with `M-x make-directory`, and create a new haskell file using C-x C-f. Add some code, and hit C-c C-l (load in ghci), and emacs will pop open a new window, launch ghci and load your code into it. You can switch over to the ghci window with C-x o (cycle windows), and type some code into it for testing. (Note it can be quite buggy if the cursor is not in the right place - there needs to be a space after the prompt > ¦). Useful keyboard shortcuts to remember here are M-p (previous) and M-n to cycle through previously used commands. (You can rebind any keys to how you wish.) You can also add typicall IDE features like "run without debugging" and such with simple snippets of elisp. Say if we want to bind F6 to this command, we can add this hack to .emacs, save and eval the expression. (global-set-key [f6] (lambda () (interactive) (async-shell-command (concat "runhaskell " buffer-file-name)))) Now with an active haskell file, F6 will launch like an application, bypassing GHCI - and emacs will typically open a new window (or replace an existing one) with the stdout/stderror for the application. That'll get you started anyway. From there, using LYAH is a good beginner resource, although it won't get you much further than past the syntax and semantics of the core language. It doesn't cover the plethora of language extensions, building projects, using cabal, haddock, quickcheck and more. I'm not aware of a single resource which covers these though - I just learned what was needed as and when by searching - the best information typically comes from one-off blogs focused on a specific problem.
- orbifold 12y agoThis http://dev.stephendiehl.com/hask/ http://dev.stephendiehl.com/hask/ overview is a little bit more advanced. It gives a good overview over the tools, some of the ecosystem and important libraries.
- codygman 12y agoA little more advanced, but this resource has been indispensable for me. Thanks Stephen!
- moron4hire 12y agoI've been reading "Learn You a Haskell for Great Good" and it has been going much more smoothly than it has apparently been going for you. It addresses pretty much all of your complaints. http://learnyouahaskell.com/ http://learnyouahaskell.com/
- ufmace 12y agoThanks, I'll check that out!