10 ms·
GHC 7.8.1 released
- Osmium 13y agoI'm intrigued by "full iOS support." Does this mean it's now possible to write iOS apps using a Haskell backend?
- SmileyKeith 13y agoAssuming it has something to do with this[0] but I'd be interested to know as well. [0]: https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompilin...
- sigzero 13y ago"In particular, GHC now has all the necessary patches to support cross compilation to Apple iOS, using the LLVM backend."
- thinkpad20 13y agoI'm also intrigued. How would one program for iOS in a practical sense with Haskell? A great deal of iOS programming, as I understand it, is navigating the APIs and libraries provided by the SDK... is this a simple task in Haskell? The FFI is something I haven't really dealt with much yet. I guess people could/will start writing wrapper libraries?
- JoshTriplett 13y agoHaskell has one of the best FFIs I've ever seen; calling C code from Haskell is quite trivial, and you can write all of the necessary wrapper code and objects (such as automatic memory management or object destruction) in Haskell using common wrappers. I'd also highly recommend c2hs for writing new wrapper libraries.
- lucian1900 13y agoPart of the problem is that iOS APIs tend to be Objective-C, which is somewhat harder to wrap in Haskell.
- gregschlom 13y agoNot really, it's quite easy to call Objective-C methods (or more correctly, to send messages to Objective-C selectors) and perform other Objective-C-related tasks from C. See: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html https://developer.apple.com/library/mac/documentation/Cocoa/... This is actually what the Objective-C compiler does. It translates your Objective-C code to C method calls.
- chc 13y agoIt's not that easy. I mean, just sending a message could entail one of objc_msgSend, obj_msgSend_stret or objc_msgSend_fpret, and which one you want to use is not always as clear-cut as you might prefer (http://www.sealiesoftware.com/blog/archive/2008/10/30/objc_explain_objc_msgSend_stret.html http://www.sealiesoftware.com/blog/archive/2008/10/30/objc_e...). And then there's the hassle of defining classes dynamically, which entails six function calls just to create a class with one empty method, and one of those essential functions is not actually provided for you AFAIK unless you're using Apple's compiler where it's a builtin, so you'll need to write it yourself. It's not ridiculously hard, but it's somewhat less easy than normal C FFI.
- iand675 13y agoThe other hard part about it is that Haskell's FFI doesn't support variadic functions in a friendly way, which makes argument passing that much trickier.
- chc 13y agoThere is a similar problem with objc_msgSend in C: Methods with certain argument types can't be called with a normal objc_msgSend(). Instead, you need to create a specifically typed function pointer and assign objc_msgSend to it. I think a similar solution would be necessary with Haskell.
- chc 13y agoI think the idea is that you would use the standard tools for the edges of the program with a Haskell core underneath handling the thinky bits. (I have no experience at all doing this, but it seems like the natural use case.)
- efnx 13y agoYes - you can now compile Haskell code to run on iOS. There are still a few unusual steps that involve ffi but its pretty easy to get a trivial project up and running. I have an unfinished project that shows the process. https://github.com/schell/blocks https://github.com/schell/blocks
- carterschonwald 13y agoYes. Everything but certain naive use of template Haskell or use of ghci is supported for targeting IOS. There's also some related engineering to provide android support
- icetortoise 13y agoWhile this is nice, it results in a big static lib(27M) to include in your app. This might be okey for some games, but maybe not for small apps. I was very interested in a Haskell app, but eventually gave up because of this...
- maxpow4h 13y agothe twitter app is 30M, we have already past the point of sensible app sizes. edit: fb messenger is 60M, a ghc-ios app with the elm compiler baked in is 24M.
- tvon 13y agoTo me that makes it clear that a minimum size of over 20M is a serious problem. How crazy would it be if the Twitter app was over 50M, or Facebook Messenger over 80M?
- tvon 13y ago(I should not have said "serious problem", I should have said "notable barrier to adoption." That people have made this possible at all is fantastic.)
- lukexi 13y agoI'll be giving a workshop on using GHC iOS at BayHac 2014 [1] along with a demo of http://tree.is http://tree.is which is built entirely on top of it! [1] http://www.haskell.org/haskellwiki/BayHac2014 http://www.haskell.org/haskellwiki/BayHac2014
- ciferkey 13y agoGreat! Can't wait until the next release of the Haskell Platform now.
- Sir_Cmpwn 13y agoI really want to get into Haskell, but I just don't understand it. The tutorial on the official site doesn't do it for me. Can anyone suggest alternative resources for learning? I'm used to C-like languages. Thanks for all the responses. I'll start with LYAH.
- bretthoerner 13y agohttp://learnyouahaskell.com/chapters http://learnyouahaskell.com/chapters
- Dewie 13y agoLearn You A Haskell For Great Good (free online book) is the most common recommendation for beginners.
- gamegoblin 13y agoI tried getting into haskell probably 3 times before it really stuck with me. After getting over the initial hump it's heavenly. I started with LYAH like others have recommended. Persistence!
- dmunoz 13y agoLearn You a Haskell for Great Good! has already been recommended, which I would have said if it had not yet been. There is also Real World Haskell [0]. It's a lot less long winded than LYaH, which is good or bad depending on how you like to digest information. Also, check out FP Complete's FP Haskell Center [1]. It contains community written tutorials with inline runnable code examples, so you can really get a feel for Haskell by manipulating and playing with the examples right on the site. [0] http://book.realworldhaskell.org/read/ http://book.realworldhaskell.org/read/ [1] https://www.fpcomplete.com/business/fp-haskell-center/ https://www.fpcomplete.com/business/fp-haskell-center/
- RaphiePS 13y agoI'm a big fan of http://learnyouahaskell.com/ http://learnyouahaskell.com/
- tel 13y agoOthers have linked tutorials. I'm going to leave some advice: pretend like you're learning to program from scratch. Not just mentally but in how you invest. It will likely take some amount of time, it will likely happen in stages of progressively receding complete astonishment and confusion, and you will be served to be proud of silly things like getting simple programs to even compile. Sounds kind of miserable, right? That's why you should also prepare for it with some of that early curiosity and wonder that drove us all to learn programming to begin with. Haskell is probably unlike anything you've used before.
- tree_of_item 13y agoIs GHCJS easy to install now? I'm very excited about that.
- carterschonwald 13y agoLuite is probably going to announce something like that in a few days. Ghcjs getting ready for general release was blocked by ghc 7.8.1 not being released.
- reirob 13y ago[..] http://www.haskell.org/ghc/docs/7.8.1/html/users_guide/type-class-extensions.html#overloaded-lists http://www.haskell.org/ghc/docs/7.8.1/html/users_guide/type-... [..] This extension allows programmers to use the list notation for construction of structures like: Set, Map, IntMap, Vector, Text and Array. The following code listing gives a few examples: ['0' .. '9'] :: Set Char [1 .. 10] :: Vector Int [("default",0), (k1,v1)] :: Map String Int ['a' .. 'z'] :: Text http://www.haskell.org/ghc/docs/7.8.1/html/users_guide/type-class-extensions.html#overloaded-lists http://www.haskell.org/ghc/docs/7.8.1/html/users_guide/type-...
- carterschonwald 13y agoFor those who write large scale applications, web or otherwise, the mio io manager improvements should be especially exciting. See http://www.reddit.com/r/haskell/comments/1k6fsl/mio_a_highperformance_multicore_io_manager_for/ http://www.reddit.com/r/haskell/comments/1k6fsl/mio_a_highpe... for a prior discussion.
- hamidr 13y agoI was reading the paper and got stuck somewhere when I saw this: > With Mio, realistic HTTP servers in Haskell scale to 20 CPU cores, achieving peak performance up to factor of 6.5x compared to the same servers using previous versions of GHC. The latency of Haskell servers is also improved: <snip> under a moderate load, reduces expected response time by 5.7x when compared with previous versions of GHC > Available with GHC 7.8.1 Nice job.
- carterschonwald 13y agoOne really cute feature that some systems folks might like is there's now support for calling the CPU/hardware prefetch instruction where applicable. http://www.haskell.org/ghc/docs/7.8.1/html/libraries/ghc-prim-0.3.1.0/GHC-Prim.html#g:28 http://www.haskell.org/ghc/docs/7.8.1/html/libraries/ghc-pri...
- sanxiyn 13y agoEven better, if you use vector library, prefetch instructions are automatically (and nearly optimally) inserted for your loops written in higher-order functions like fold. Details here: http://research.microsoft.com/en-us/um/people/simonpj/papers/ndp/ http://research.microsoft.com/en-us/um/people/simonpj/papers...
- carterschonwald 13y agoNope. That's not in the release version. Simd is still second class in ghc. Should be viable for ghc 7.10 though. Note well, the prefetches in that paper aren't optimal. In many cases prefetch is over issued. You should only use prefetch when benchmarks show that the hardware prefetch isn't performing up to sniff. Or when your access pattern for data doesn't have good locality and doesn't resemble a linear arithmetic sequence. (Just rules of thumbs mind you. For more precise heuristics, please read your CPU vendors optimization manual. The intel manual has quite a few tricks that should apply to most modern CPUs overall)
- masida 13y agoWhat will be the easiest way to get GHC 7.8.1 running alongside the official GHC packages for Debian (specifically Jessie)? Should I download a package from http://deb.haskell.org/ http://deb.haskell.org/? If so, where can I find 7.8.1?
- carterschonwald 13y agoThat is maintained by an active ghc contributor, so should be safe to use!
- JoshTriplett 13y agoGHC 7.8 is already packaged in Debian experimental, so if you're running current testing, you may find it easiest to just add sources for experimental and sid, set the default release to testing (so you don't upgrade anything else), and then install GHC 7.8 directly. You'll end up upgrading a pile of Haskell packages to versions from experimental, but mostly not the rest of your system.
- thoughtpolice 13y agoYou can use these PPAs from our friend, Herbert: https://launchpad.net/~hvr/+archive/ghc/ https://launchpad.net/~hvr/+archive/ghc/ They are packaged for Ubuntu, technically (12.04 Precise) but you can just add the apt-repository line to your `sources.list` and it will work fine, and plenty of people are doing this. A repository for the STABLE branch will eventually appear on http://deb.haskell.org http://deb.haskell.org, but I'm not sure when Joachim will do this.
- jberryman 13y agoThe binary distributions install alongside your system packages or other bindists quite nicely (they might overwrite the /usr/bin/ghc symlink, but that's it) and you can select which ghc version you want to use when using cabal with the `-w` flag. Each will keep a separate package db, etc. So be bold!
- masida 13y agoThank you for your comment. I've ended up installing 7.8.1 from the binary distributions from the GHC site: http://www.haskell.org/ghc/download_ghc_7_8_1 http://www.haskell.org/ghc/download_ghc_7_8_1 As easy as: tar -xJvf ghc-7.8.1-i386-unknown-linux-deb7.tar.xz cd ghc-7.8.1 ./configure --prefix=/opt/ghc-7.8.1 make install
- swift 13y agoI don't recall ever being excited about a compiler release before, but this has got me excited. Typed holes, overloaded lists, pattern synonyms, new IO manager, new code generator, interruptible FFI calls, parallel compilation, and tons of other new features. One thing I'm particularly excited about is the switch to use the system's dynamic linker instead of a custom one in GHCi. The custom linker GHCi used before didn't support some features used by C++ code, which meant that some of my FFI-based projects weren't usable in GHCi. This also affected other things that used a GHCi-like code path like Template Haskell and the GHC APIs used by ghc-mod/hdevtools. This will be huge for usability for me when working on projects that link to C++. Hat tip to all the GHC developers for a truly amazing release!
- thoughtpolice 13y agoThe dynamic switch isn't without its pain points. In particular, the way we currently implement it leaves some things to be desired, and it's lead to some other rather unfortunate ramifications for Windows right now. Truthfully, me and Simon now have reservations about if this is the right way to go, and we should instead invest more infrastructure into our own Linker (which, independently, got some nice bug fixes this time around - constructors and weak pointers now work, for example.) ELF support is quite complete (and very stable) for example. It's just a question of what's the most work.
- izietto 13y agoI want to find a job as Haskell programmer!
- dllthomas 13y agoI've projects I'd be willing to delegate, if I can pay you sufficiently little...
- jc79 13y agoSharing izietto's wish, how might one contact you?
- dllthomas 13y agoYou can shoot me an email (davidleothomas@gmail.com) or hit me on irc (davidthomas on freenode - I typically lurk in #haskell and #snowdrift, amongst other places). I don't want to get hopes up too high - sufficiently little isn't going to be much in the short term.
- dbbolton 13y agoA bit off topic- why is GHC so large? I recently noticed it was over three times the size of gcc (for amd64, in an .xz archive).
- thinkpad20 13y agoThis might be interesting to you: http://stackoverflow.com/questions/4858585/why-is-ghc-so-large-big http://stackoverflow.com/questions/4858585/why-is-ghc-so-lar...
- jeorgun 13y agoNow I'm kind of curious. The GHC is listed there as being 113 megabytes. When I try to install it on Arch Linux, the size is listed as 736MB! What in God's name is Arch doing to nearly septuple the size of this package— and more to the point, does anyone know any way of getting it to not do that? I'd very much like to learn Haskell, but taking up that much space on my laptop's SSD is a dealbreaker.
- thoughtpolice 13y agoThat's because they're measuring the tarball, which is a worthless metric anyway (for example, we just switched to supporting .tar.xz, which reduced the size of Linux binary distributions close to 50% for a ~65MB total. But that doesn't tell you anything about what's inside.) The unpacked binary distribution is closer to 1GB, which sounds about right. I speculate Arch Linux is doing a regular build with nothing special. If 1GB is undoable for your laptop (which I find odd, as someone even on a 100GB device), then that's unfortunate. You're best to wait for some other build with things removed or to just build it yourself (for example, no dynamic linking).
- elwell 13y agoShort answer: GHC is not just a compiler; it's also a rather large library.
- Avalaxy 13y agoThis is great news for all 5 haskell programmers! Just kidding, Haskell is a great language, it's unfortunate that the tooling is still way behind (at least on Windows) and that it isn't used much.
- BSousa 13y agoI know enough about Haskell to be excited, but recently, I implemented a few systems with F# and am really happy with the language. If we forget about the .net/MS thing (and all the hatred that comes from that), are there real true advantages of going Haskell for a greenfield project over F# ? (I have a couple heavy algorithm heavy Haskell projects done, but having worked with F# more and more, I feel like it is so much nicer as a modern, not bend over your back to deal with the purity/lazy aspects language than Haskell).
- chowells 13y agoI've been playing around with the new PatternSynonyms extension. In combination with the existing ViewPatterns extension, I'm going to really have to change the way I think about API design. This is actually pretty fantastic. {-# LANGUAGE ViewPatterns, PatternSynonyms #-} import Data.Set as S -- patterns that a library might provide pattern x :< m <- (minView -> Just (x, m)) pattern m :> x <- (maxView -> Just (x, m)) pattern Null <- (S.null -> True) -- a really dumb test function using those patterns doubleMin :: (Ord a, Num a) => Set a -> Set a doubleMin (x :< s) = insert (2 * x) s doubleMin x = x Ignore how dumb my test function is, and just focus on how lightweight it becomes to match views of the data structure. Figuring out what patterns to include my libraries is going to be a fun new design point.
- axman6 13y agoI haven't had a look at the extension definition itself, but I find this really hard to read. Can you or someone else give an explanation of what's going on? It seems to me that the brackets are all wrong, I would've expected pattern (x :< m <- minView) -> Just (x,m) but that's just basically view patterns/pattern guards. Basically I can sort of see what's going on here, but only in this specific case; I can't see how one uses this elsewhere.
- chowells 13y agoThe choice of character for unidirectional patterns isn't the greatest, I'll agree. The PatternSynonyms extension enables two new top-level declarations, both declared with "pattern". pattern NestedJust x = Just (Just x) pattern NestedNothing = Just Nothing That's the easier syntax of a bidirectional pattern synonym. They can be used both as patterns and as expressions. foo :: Maybe (Maybe Int) -> Bool foo (NestedJust 7) = True foo (NestedNothing) = False foo _ = False bar :: Maybe (Maybe String) bar = NestedJust "hello" There are a couple terrible examples. Bidirectional pattern synonyms must be valid as both expressions and pattern matches, or you get a compile error My example was using unidirectional pattern synonyms. They allow any pattern match whatsoever as the body; the expression restriction is dropped because they aren't allowed to be used in expression contexts. They are defined using <- instead of =. pattern MinView x m <- (minView -> Just (x, m)) That's functionally the same as the :< example above, but possibly a bit simpler to read, because the precedence of the symbols is more obvious. It defines a pattern synonym named MinView that is translated to the view pattern in parens. It's quite possible you were conflating view pattern syntax with pattern guard syntax as the source of your confusion.