News aggregator

Autocomplete command line options with GHC 7.8

Haskell on Reddit - Wed, 04/16/2014 - 9:22am

GHC 7.8 adds --show-options flag that prints all supported command line flags on standard output. This can be used to enable autocompletion of command line options for ghc in shells that support autocompletion. If you're using bash add this snippet to your ~/.bashrc file:

# Autocomplete GHC commands _ghc() { local envs=`ghc --show-options` # get the word currently being completed local cur=${COMP_WORDS[$COMP_CWORD]} # the resulting completions should be put into this array COMPREPLY=( $( compgen -W "$envs" -- $cur ) ) } complete -F _ghc -o default ghc

Enjoy.

PS. I also added a wiki page: https://ghc.haskell.org/trac/ghc/wiki/AutocompleteGHCFlags Feel free to add instructions for other shells.

submitted by killy9999
[link] [10 comments]
Categories: Incoming News

Jan Stolarek: Autocomplete command-line flags with GHC 7.8.2

Planet Haskell - Wed, 04/16/2014 - 8:48am

GHC 7.8.2 has been released just a few days ago1. This is the first official release of GHC that contains my contributions. Most of them are improvements in the code generator and are thus practically invisible to most users. But I also implemented one very nice feature that will be useful to an average Haskeller. GHC now has --show-options flag that lists all command-line flags. This feature can be used to auto-complete command-line flags in shells that support this feature. To enable auto-completion in Bash add this code snippet to your ~/.bashrc file:

# Autocomplete GHC commands _ghc() { local envs=`ghc --show-options` # get the word currently being completed local cur=${COMP_WORDS[$COMP_CWORD]}   # the resulting completions should be put into this array COMPREPLY=( $( compgen -W "$envs" -- $cur ) ) } complete -F _ghc -o default ghc

From my experience the first completion is a bit slow but once the flags are cached things work fast.

  1. Please ignore 7.8.1 release. It shipped with a bug that caused rejection of some valid programs.
Categories: Offsite Blogs

Philip Wadler: Team Scotland

Planet Haskell - Wed, 04/16/2014 - 6:19am
What happens after Yes? It's not the SNP, it's the people. A great post on Bella Caledonia.
The UK chattering classes have been wondering what a real, mass grass-roots campaign might look like in modern, professionalised politics. Impotent is their usual conclusion. Well come on up and we’ll show you. The old feudal dance where councilor doths cap to MP, MP to Minister, Minister to Prime Minister and Prime Minister to corporate CEO may well continue apace even here in Scotland. But it’s not winning Scotland.
Categories: Offsite Blogs

Philip Wadler: Help ORG restart the debate about internet filters

Planet Haskell - Wed, 04/16/2014 - 5:59am
The Open Rights Group is starting a campaign opposed to the default filtering now imposed by all providers in the UK---de facto censorship. You can fund it via IndieGogo.
Categories: Offsite Blogs

CLaSH.Tutorial

del.icio.us/haskell - Wed, 04/16/2014 - 2:58am
Categories: Offsite Blogs

faylang/fay

del.icio.us/haskell - Tue, 04/15/2014 - 10:58pm
Categories: Offsite Blogs

LtU now supports Mathjax

Lambda the Ultimate - Tue, 04/15/2014 - 12:56pm

LtU now supports MathJax, which allows the use of TeX markup in posts and comments. Note that only TeX/LaTeX markup is currently supported - the alternate MathML format conflict's with the blog's HTML sanitization.

This enhancement is dedicated to neelk, who most recently suggested this feature just over a year ago.

When I went searching for a bit of Mathjax-compatible LaTeX that was relevant to programming languages, the first good example Google found for me was on Neel's blog:

$$
\newcommand{\val}[1]{\mathsf{val}\,{#1}}
\newcommand{\rule}[2]{\frac{\array{#1}}{#2}}
\newcommand{\judge}[3]{{#1} \vdash {#2} : {#3}}
\newcommand{\letv}[3]{\mathsf{let}\;{#1} = {#2}\;\mathsf{in}\;{#3}}
\begin{array}{ll}
\rule{\judge{\Gamma}{e}{A}}
{\judge{\Gamma}{\val{e}}{T(A)}}
&
\rule{\judge{\Gamma}{e}{T(A)} \qquad
\judge{\Gamma, x:A}{e'}{T(C)}}
{\judge{\Gamma}{\letv{\val{x}}{e}{e'}}{T(C)}}
\end{array}
$$

Copy-pasting the above and making it work immediately made it clear that we're going to need a package of useful macros. But it's a start. Feedback welcome.

Note that MathJax rendering is entirely client-side - if you don't see a well-formatted formula above, check the MathJax browser compatibility page and their FAQ.

Categories: Offsite Discussion

Douglas M. Auclair (geophf): 'K' is for Kappa-calculus

Planet Haskell - Tue, 04/15/2014 - 12:48pm

'K' is for κ-calculus
This is an epic story of epic epicness!
No, really.
So, way back when, this guy named Church (Alonzo was his Christian name, and he liked going to churches)
(Actually, that's just conjecture on my part.)
Okay, everybody, stop everything and go to this wikipedia link on the Frege-Church ontology, right now.
Have you read it?
Well, what are you waiting for, read the post, for goodness sake!
I'M WAITING!
...
Okay.
So, I read the post, and I was all like skyr, you know? No whey!
Like, totally! Like. I mean, like, wikipedia, wrote that?
So, I quizzed my girls:
"Girls!" I shouted excitedly, "What's the farthest planet from the Sun?"
They were like, "Whaaaaa?"
Then they asked, like, "Papa!" with arched eyebrows, "why do you want to know what's the farthest plant from the Sun?"
Hm. I, like, have to work on my, like, diction.
(We'll get to the reason behind the paroxysms of 'like's momentarily.)
So, I clarified, "Planet, planet!" I shouted, "What's the farthest planet from the Sun!"
EM, the older, and therefore smarter one (she has to be, you see), said, "Pluto. No, wait. Pluto's not a planet. Neptune, then!"
"HAAAAAA!" I screamed.
Elena Marie looked at me like her Papa had finally gone off the deep end.
Well, finally off the deep end, but this time, never to return, gone-off-the-deep kind-of-way.
But before I could explain my victorious berserker scream ...
(Berserker, n.: etymology: íslandic, "Bear Skinned")
(Question: what is the etymology of the word 'etymology'?)
(Did you know Icelandic is an insular Nordic language? They can read the poetic and prose eddas straight off, just like that. Could you read a 1,000 year old document? No, you can't, unless your an Icelander. So there.)
(But I digress.)
(As always.)
(The neat thing here, is this is a digression, from a digression! And it's not even leading us back to the topic, but further away) (just as this digressionary turn discussing my digressionary habits).
(Digressions within digressions within digressions.) (Move over, Frank Herbert, you dead old guy, you're not the only one who can write 'Wheels within wheels within wheels' and have a really bad movie with a Sting cameo made out of your book!)
BUT BEFORE I COULD EXPLAIN my berserker-scream, Li'l Iz piped right up.
"How can you know what's the farthest planet of the Sun, huh, Papa? There're other planets in this galaxy, and what about other galaxies, huh?"
She had me there. But never confuse the point you're trying to make with facts.
WHEN I REREAD what I wrote to my girls, they sighed, appreciatively, EM said, "How ironic can that be?" and walked off to her room to read another book before her ballet recital in forty-five minutes.
I asked Li'l Iz, "Was that, like, ironic?"
She rolled her eyes and deigned not to answer, returning to her own book.
SO, the POINT of all this is:
Pluto is not a planet!
Whew!
I'm so glad that the ravings of a madman in Borderlands 2 would actually have significance to mathematical logic theory. The things one learns by reading blogposts by the geophfmeister.
(That is moi-self) (That is French) (No, it's not.)
Ooh! Digression!
When I was working with some Ph.D.'s and cognitive scientists, I worked with this flaming-red-haired dude (cognitive scientist) named Bill. He would always say 'Gratzi' to people answering his questions, I would always respond: "That is French."
He always gave me weird looks, but he never got the nerve to correct me.
Until one day, he said 'Gratzi' to one of our analysts, and I said, 'That is French.'
She looked me dead in the eye and snarled a disdainful, "Who cares?" before stalking off.
Bill was on the floor, suffering a paroxysm of laugher.
I think that was the best day of his life.
ANYWAY!
Pluto, not planet ... It's not even a plant.
Besides which, Eris is more massive than Pluto, anyway. So there.
Hail, Eris!
SO!
The Lambda calculus ('L' is for Lambda calculus) addressed a certain set of concerns, which I'll get to in Monday's post, but it, like mathematics in general, has its own set of problems, that is, you can write a function that never terminates and so it is undecidable.
So, along came this little kid by the name of Masahito Hasegawa (dunno, maybe he's Italian?) and he noticed something, and that was this: the problem of the lambda calculus is that it's actually two calculi intertwined. And when you disentangle them, you have two distinct calculi, neither of which are undecidable.
The first of the calculi, the one we focus on here, is the κ-calculus, or contextual calculus.
The κ-calculus is this.
The types are pairs of unit types:
τ : 1|τ x τ|...
So, you see from the types that it's either nothing (the 1, or unit type) or it's a (crossed, or cartesian product) of types.
The functions only take these types, NOT functional types, so we're safe in that we're only working with unit types.
The primary operation is the lifting function, which takes an instance and lifts it into the type of concern.
liftτ x -> (a, x) where a is of type τ
Then the κ-abstraction that when acting with an instance carries it along:
κ x . (some function (τ1, τ2) -> τ3) : τ3
Tying lift and the κ-abstraction together gives us our function 'application' where actually no application happens, it's all just composing (in this case) tuples.
Categories: Offsite Blogs

Anyone have a "guide" to reading TaPL?

Haskell on Reddit - Tue, 04/15/2014 - 6:20am

Sorry if this isn't the place to ask this, but I know a lot of you have read Types and Programming Languages. I want to read it also, over the summer.

I tried last year and failed, I think partially because I was too busy when I picked it up. I heard later on that there are certain sections that can be skimmed or skipped over, and some sections that I should really put focus into. Just wanted to hear any suggestions anyone might have.

Thanks!

submitted by 5outh
[link] [8 comments]
Categories: Incoming News