News aggregator

Philip Wadler: I Shall Vote No

Planet Haskell - Sun, 04/27/2014 - 5:58am

Spotted on Bella Caledonia.[After Christopher Logue, I Shall Vote Labour (1966)]
By A.R. Frith
I shall vote No because, without Westminster, We’d never have got rid of the Poll Tax
I shall vote No because eight hundred thousand Scots live in England, and there are no jobs here to match their talents and meet their aspirations
I shall vote No, because my grandmother was a MacDougall
I shall vote No in case Shell and BP leave and take their oil with them
I shall vote No because otherwise we would have to give back the pandas
I shall vote No because I am feart
I shall vote No because the people who promised us a better deal if we voted No in 79, and warned us of the dire consequences of devolution in 97, tell us we should
I shall vote No so as not to let down my fellow socialists in Billericay and Basildon
and
I shall vote No, because if we got rid of Trident and stopped taking part in illegal wars we would be a target for terrorism
I shall vote No because if I lived under a government that listened to me and had policies I agreed with, I wouldn’t feel British
I shall vote No because the RAF will bomb our airports if we are a separate country
I shall vote No because to vote Yes dishonours the Dead of the Great War, who laid down their lives for the rights of small nations
I shall vote No, lest being cut off from England turns Red Leicester cheese and Lincolnshire sausages into unobtainable foreign delicacies, like croissants, or bananas
I shall vote No, because, as a progressive, I have more in common with Billy Bragg or Tariq Ali, who aren’t Scottish, than some toff like Lord Forsyth, who is.
I shall vote No, because the certainty of billions of pounds worth of spending cuts to come is preferable to the uncertainty of wealth
I shall vote No, because it is blindingly obvious that Scotlands voice at the UN, and other international bodies, will be much diminished if we are a member-state
I shall vote No because having a parliament with no real power, and another which is run by people we didnt vote for, is the best of both worlds
I shall vote No because I trust and admire Nick Clegg, who is promising us Federalism when the Liberals return to office
I shall vote No, because Emma Thompson would vote No, and her Dad did The Magic Roundabout
I shall vote No, because A.C. Grayling would vote No,and his Mum was born on Burns Night
I shall vote No because David Bowie asked Kate Moss to tell us to, and he lives in New York and used to be famous
I shall vote No, because nobody ever asks me what I think
I shall vote No, because a triple-A credit rating is vital in the modern world
I shall vote No because things are just fine as they are
I shall vote No because the English say they love us,
and that if we vote Yes, they will wreck our economy.
Categories: Offsite Blogs

Philip Wadler: Silicon Valley could force NSA reform, tomorrow. What's taking so long?

Planet Haskell - Sun, 04/27/2014 - 5:57am

<figure class="element element-image" data-media-id="gu-fc-3e1d8f3a-dd53-4f60-9376-ccc2021cc1eb" style="background-repeat: no-repeat no-repeat; border-collapse: collapse; margin: 0px 0px 10px; padding: 0px;"><figcaption style="background-repeat: no-repeat no-repeat; border-collapse: collapse; color: #666666; font-size: 0.858em; line-height: 1.25; margin: 0px 0px 10px; padding: 0px;">CEOs from Yahoo to Dropbox and Microsoft to Zynga met at the White House, but are they just playing for the cameras? Photograph: Kevin Lamarque / Reuters</figcaption></figure>Trevor Timm asks a key question in The Guardian:
The CEOs of the major tech companies came out of the gate swinging 10 months ago, complaining loudly about how NSA surveillance has been destroying privacy and ruining their business. They still are. Facebook founder Mark Zuckerberg recently called the US a "threat" to the Internet, and Eric Schmidt, chairman of Google, called some of the NSA tactics "outrageous" and potentially "illegal". They and their fellow Silicon Valley powerhouses – from Yahoo to Dropbox and Microsoft to Apple and more – formed a coalition calling for surveillance reform and had conversations with the White House.
But for all their talk, the public has come away empty handed. The USA Freedom Act, the only major new bill promising real reform, has been stalled in the Judiciary Committee. The House Intelligence bill may be worse than the status quo. Politico reported on Thursday that companies like Facebook and are now "holding fire" on the hill when it comes to pushing for legislative reform.
...
We know it's worked before. Three years ago, when thousands of websites participated in an unprecedented response to internet censorship legislation, the Stop Online Piracy Act (Sopa), the public stopped a once-invincible bill in its tracks. If they really, truly wanted to do something about it, the online giants of Silicon Valley and beyond could design their systems so that even the companies themselves could not access their users' messages by making their texting and instant messaging clients end-to-end encrypted.
But the major internet outfits were noticeably absent from this year's similar grassroots protest – dubbed The Day We Fight Back – and refused to alter their websites à la Sopa. If they really believed the NSA was the threat so many of them have claimed, they'd have blacked out their websites in protest already.
Categories: Offsite Blogs

Kevin Hammond

del.icio.us/haskell - Sun, 04/27/2014 - 5:38am
Categories: Offsite Blogs

Douglas M. Auclair (geophf): 'W' is for It's My BIRTHDAY today! ... and Comonads

Planet Haskell - Sun, 04/27/2014 - 5:30am

'W' is for 'Whaaaaat...?' (Comonads) ... and 'W' is for 'It's my birthday today! YAY!'
That's actually a 'Y' in 'YAY,' but when you string two Y's together: YY, you get something that looks like a W ... or two martini glasses next to each other, husband and wife, take your pick.
And 'Wife' starts with the letter 'W,' so there you go!
Wife, n: ORIGIN Old English wīf [woman,] of Germanic origin; related to Dutch wijf and German Weib.
All very ... Vikingescque. 
... In a good way.
So, 'W' is for 'It's my party and I'll cry if I want to, cry if I want to, cry if I want to! You would cry, too, if this happened to you. Da-da-da-da-da-dat!' (youtube vid)
But I don't feel like crying at all! I (ain't) happy, I'm feeling glad, I've got sunshine, in a bag, I'm useless, but not for long, my future is coming on! [Gorillaz cartoon clip
So, yeah, that.
Okay, so to the (mathematical) topic. Why do I say 'W' is for comonad? And what is a comonad, anyway, and what is the meaning of life, the universe, and everything?
That last one is a piece of cake:
42.
I'm so glad Deep Thought covered that ground for me. Otherwise I would have looked like I didn't have the answer to something, and would've had to have made something up to assuage the masses!
Like ketchup!
But anyway, why are we even having a blog-post day for the letter 'W,' when, after all, it's as plain as day that there's no such thing as the letter 'W'! I mean, 'double'-'u' it's two 'v's together, and even 'v' is a constructed thing from 'u,' (in the Greek there is no 'v,' they use 'β' so it's Blad, the impaler), so 'v' and 'w,' today and yesterday, are silly posts for silly days for letters that don't even exist!
AND it's my birthday today, and did I get cake? Huh? Did I? Huh? Or am I here, all alone, writing this blog entry about the non-extant letter 'W' and comonads? Huh? Huh? I ask you!
(Cue entry of my daughter, EM, baring gifts of gold, frankincense and cake.)
Ooh! Cake! What flavor is that?
EM: Dark chocolate mousse.
Ooh! My favorite!
Excuse me a moment whilst I indulge after much being-sung-Happy-Birthday-to.
(nom-nom-nom!)
Okay, I'm back.
Okay. 
W. 
Comonads.
Okay, geophf, how in the world does 'W' have anything to do with Comonads?
Okay, so Comonads are the dual to monads, and, in the literature, the monadic types are represented by 'm' and monadic functions are prefixed with a little-m or suffixed by a capital-M (depending on their mode of use:
msum :: Monad m, Num a => [m a] -> m aliftM :: Monad m => (a -> r) -> m a -> m rmapM_ :: Monad m => (a -> m b) -> [a] -> m ()
You see how that works? m-functions work with monads, simplifying them, whereas function-Ms work with non-monad forms, putting them into the monadic domain), complexifying simpler objects.
So that explains the 'M' for monads ...
... although there is the whole question lingering as to why they are even called 'monads' (one thing) as they are the triple:
(M, μ, η) where:
M is the monadic type,μ is the join-function such that join :: Monad m => m (m a) -> m a; and,η is the unit-function such that unit :: Monad m => a -> m a
(the unit-function, in Haskell, is known as the return-function)
Monads from mathematics were originally called 'triples,' because that's what they are, monads from philosophy mean something else entirely, so occasionally we get a logician in the mathematics forum asking what the hell we're all taking about!
So, 'monads' (misnamed) are represented by 'm' for their type-families.
So, comonads (mis-co-named) are monads' duals, so their type-families are represented by the inverted symbol of monads, comonads have the type-variable: w.
Get it? Got it? Good!
Now, I could go all 'w' is 'ω' and say that it represents Ohm, and Ohm's laws, ...
but then this post would be all chanting:
Ohm, Ohm, Ohm, Ohm, Ohm, Ohm, Ohm, ... (youtube link)
And there's something in that for some, I suppose, but not here nor now.
Here and now we're talking about the comonad.
The Comonad is the dual of the monad, so it is a co-triple of the form:
(W, δ, ε) where:
W is the Comonadic typeδ is the duplicate-function such that duplicate :: Comonad w => w a -> w (w a); and,ε is the extract-function such that extract :: Comonad w => w a -> a
For monads, you can only push 'plain-old' objects up into the monadic domain and once there, you never leave it. You can't get an object out of a monads.
For comonads, you can only extract 'plain-old' objects from the comonadic context, and once extracted, it's free of the comonad. You can't make comonads from plain-old objects.
For monads, they have join and monadic-bind, stringing together operations in the monadic domain:
(>>=) :: Monad m => m a -> (a -> m b) -> m bm >>= f = join . fmap f
(given that the monad is a functor, as well)
For comonads, they have duplicate and comonadic-extention, extending the comonadic context over the computation:
(=>>) :: Comonad w => w a -> (w a -> b) -> w bw =>> f = fmap f . duplicate
(again, when the comonad is a functor as well)
So, like, Monads and comonads are, so, like, totes the opposite.
Dude. (The Dude Abides)
For me, personally, I didn't 'get' comonads for a long, long time. What was the point of them? I wondered, but now I see them everywhere.
The object-model of object orientation is not so well-understood as the categorical representation of functional programming, but one approach is the Ω-calculus.
That's one way of seeing OOP. I see it, perhaps in the same way, but, I don't think so. I see object-orientation with inheritance from the Art of the MetaObject Protocol, and from that perspective, objects and inheritance are totally comonadic. You have the computational context of the parent class and you extend that to your child class (or your child class extends the computational context).
Totally comonadic.
For-loops, modeled by folds, yes, but these are also an entirely comonadic thing. You're extending the context of your loop over the life of your computation.
Comonads are everywhere!
... except not maybe so much in if-then-else ... monads fit that so much more naturally, or a transformation on the Either type.
Either way.
Comonads. Don't worry about it if you heard about them but you just don't get them. I was there for years. Just keep doing what you're doing, 'normal' functional programming, and you're way ahead of the game. Monads and applicative functors? Go to town! Arrows? You rock.
But, for me, one day it came to the point that I was monad-ing myself to death, and I wondered, 'is there a better way?'
And then that's when I looked at comonads, again.
So, where do I use them now? and for what? and how?
The 'how' is so trivial it's really pointless to go over them. Most people, for this very reason, look at comonads, and say, 'yeah, but ... that's the map-function, right?' and eh-onto other things.
Kind of like how monads should be used.
"Eh, but that's a function, right?" and eh-move onto your next task.
But monads are so novel for most people, that we're still in the honeymoon phase, and we will be there, for, oh, another fifty years or so (it will take that long for the very idea to be introduced and then absorbed into the mainstream programming culture).
But until that time, there'll be this love-affair with monads, with the dual-neglect of comonads (note that on the wikipedia page, comonads are a footnote to monads. This dismissive treatment of comonads is not uncommon). Sigh.
I use comonads to look at things in other ways.
Say I have this list-of-lists:
Date,Open,High,Low,Close,Volume,Adj Close[[2011-03-30,64.56,64.86,63.50,63.96,1554600,63.76],[2011-03-29,63.51,64.26,62.80,64.13,2336800,63.93],[2011-03-28,63.06,64.33,62.47,62.70,1410900,62.50],[2011-03-25,62.74,63.77,61.91,62.65,2171800,62.46],[2011-03-24,62.52,62.99,59.75,62.63,5398500,62.44], ... etc.
And instead of that raw data, I wish to observe some trends in it:
Date,Open,High,Low,Close,Volume,Adj Close,sma 15,ema 12, ema 26, accum_over_distr,adx 20[[2011-03-30,$64.56,$64.86,$63.50,$63.96,1554600,$63.76,63.96,62.509083019265475,62.37404736199129,-502958.8235294094,65.70247372791911],[2011-03-29,$63.51,$64.26,$62.80,$64.13,2336800,$63.93,64.13,62.18995668453236,62.18995668453236,1920657.5342465467,72.12083595494798],[2011-03-28,$63.06,$64.33,$62.47,$62.70,1410900,$62.50,62.7,61.88254869299201,61.88254869299201,-1061967.7419354776,77.72261629109732],[2011-03-25,$62.74,$63.77,$61.91,$62.65,2171800,$62.46,62.65,61.81630406119281,61.81630406119281,-443701.07526881865,73.52367287149414],[2011-03-24,$62.52,$62.99,$59.75,$62.63,5398500,$62.44,62.63,61.73466415405274,61.73466415405274,4198833.333333336,100.0], ... etc
Comonads allow me to do this quite simply by using a little, simple technique called regression:
> regression :: ([Row] -> a) -> [Row] -> [a] -- your classic comonad> regression f rows = rows =>> f 
That takes a formula, in this case an indicator, such as the SMA (simple moving average) or the EMA (exponential, or weighted, moving average), and scanning the entire screen, giving the result for each row, returning the entire screen to you, again, but now enhanced by the comonadic function applied throughout the screen.
That's what a comonad is. You have this whole big thing, like a stock-screen of GMCR ('Green Mountain Coffee Reserves'), and the comonad takes the entire thing to operate on, and gives the result an unit (or a row) at a time.
Comonads are perfectly-fitted to the uses for which I intend them, now that I see them, finally, and know what they are and how to use them. I have this big old thing. I want to see it in a different way, and I know what result I want piece-by-piece, but, unlike for monads, that deal piecewise-at-a-time, comonad gives you the entire scope of the computational context, so if you need the previous row, for example, you have it and every other row in the history.
'W' is for Comonad. Don't worry if you don't 'get' them. They are there. They'll wait for you.
It's just that when you do start using them, you'll see their usefulness in a lot more places that you had heretofore neglected to use them, and you'll find, going forward, your work is cleaner and simpler because of them.
Categories: Offsite Blogs

relationships between Haskell 98 and GHC 7.6+

Haskell on Reddit - Sun, 04/27/2014 - 12:45am

I am reading the latest GHC documentation, and it constantly mentions "in Haskell 98" ..., this confuses me, I don't know if the content it's talking about only valid "in Haskell 98", or it's become valid since "Haskell 98", what I more care about "what about in Haskell 2010?", so is current GHC 7.6, 7.8 still referring Haskell 98 or Haskell 2010?

submitted by cakebunny
[link] [6 comments]
Categories: Incoming News

Looking for semigroup reading materal (explanations and/or examples)

Haskell on Reddit - Sat, 04/26/2014 - 8:43pm

I was reading the typeclassopedia, and most of the typeclass sections have awesome subsections with instances of the typeclass that explain why the typeclass is useful and give instances of the typeclass. However the semigroup section includes only the definition. I am looking for some reading material explaining why semigroups are useful in haskell? Any help would be much appreciated. Thank you.

submitted by 0Il0I0l0
[link] [7 comments]
Categories: Incoming News

How controversial was monadic i/o when it was new?

Haskell on Reddit - Sat, 04/26/2014 - 2:45pm

Was it seen by some as an unHaskelly intrusion of imperativeness into an otherwise pure programming language? Or was it universally accepted as being the way to go?

(As compared to the controversy the lens package is attracting.)

submitted by dave4420
[link] [9 comments]
Categories: Incoming News

How do you say '<*>'?

Haskell on Reddit - Sat, 04/26/2014 - 11:28am

Is there a generally accepted way to say <*> in English? What about angled-star? Any other name taken from its Applicative use?

submitted by mmonga
[link] [27 comments]
Categories: Incoming News