News aggregator

Building network without MSYS [Was: Splitting Network.URI from the network package]

libraries list - Mon, 08/04/2014 - 9:52pm
Hello. I consider the original proposal to be well founded and I support it. However, I started to think if there is anything we can improve about installation of network package itself? Maybe we can get rid of MSYS, at least for the end users of network package? How would that happen? The following plan came to my mind: 1. Select a single supported configuration (Windows version) 2. Execute a "normal" build with MSYS 3. Extract a configuration that was "discovered" by MSYS 4. Bake in the configuration into installation files to be used on Windows when MSYS is not present. There shouldn't be that many supported configurations on Windows. I think it is reasonable to do: 1. Windows XP 2. Windows 7 3. Windows 8 4. some Windows Server versions? For each system the variants would be: 1. 32-bit system, 32-bit GHC 2. 64-bit system, 32-bit GHC 3. 64-bit system, 64-bit GHC Right now I have done the procedure above for my own 64-bit Windows 7/32-bit GHC pair. I also added some simple logic of choosing between "Sim
Categories: Offsite Discussion

[ANN] StrappedTemplates - general purpose templates

haskell-cafe - Mon, 08/04/2014 - 6:40pm
Hello all, I found that I wasn't quite satisfied by the template offerings (Heist, Hastache, Shakespearean, etc..) of Haskell, so I built my own. The goal is to have simple syntax that non-haskellers would be comfortable using, resembles templates found in other languages (Jinja, Django, etc) and an interface to render them that I don't have to think very hard to use. Features include inheritance, logic, includes, functions, and relatively speedy rendering (much faster than interpreted templates like Heist-I and Hastache) . Its very much a work in progress, but I felt that it was enough for an initial release and get general feedback on it. Comments are appreciated. One thing that I want to improve is how functions are handled in the template and in the "InputBucket", extend the syntax to allow you to do more inside the template and be able to define your own block functions. These will probably be added next major release. http://hackage.haskell.org/package/StrappedTemplates https://github.com/hansonk
Categories: Offsite Discussion

New Functional Programming Job Opportunities

haskell-cafe - Mon, 08/04/2014 - 5:00pm
Here are some functional programming job opportunities that were posted recently: Pragmatic Haskell Developer at Anchor Systems http://functionaljobs.com/jobs/8729-pragmatic-haskell-developer-at-anchor-systems Cheers, Sean Murphy FunctionalJobs.com
Categories: Offsite Discussion

Douglas M. Auclair (geophf): Are you serious? "What degree?"

Planet Haskell - Mon, 08/04/2014 - 1:33pm
So, serious question.

An aside (get used to them, by the way), people are never sure if I'm serious.

I'm, like, seriously? C'mon!

I am always silly (well, oftentimes silly, compared to my dour workmates), but I am always serious in my silliness.

Chesterton said it well: the opposite of funny is not serious: the opposite of funny is not funny.

Okay, that aside is done. Now onto the topic at hand.

Hands up, those who have ever used your education in your jobs. Hands up, those who needed proof of your degree to prove competency as a prerequisite of employment.

(sound of crickets.)

Thought so.

Actually, more of you might raise your hands to me than to most of my colleagues, because why? Because I have close ties to academe, that's why. So there are more than a few of you who are required to have your Master's degree or, those of you who are post-docs, to have your Ph.D. to get that research position or grant that you're working on.

The rest of the world?

No.

Education, in the real world, is a detriment to doing your job.

Across the board.

A.
Cross.
The.
Board.

Do you know how many Ph.D.s we fire? Do you know how many Ph.D.s and matriculated students we turn away, because of their education and their lack of real-world experience?

We did a survey: a sure bell-weather for a prospective employee? The amount of their education: the more they have, the more likely they are to be useless on the job.

It's the Ph.D-disease: 'Ph.D: "piled high and deep."' People get ed-ju-ma-kated and then they think because they have a sheepskin or that they have a certain GPA at a certain school and know a certain ... educated way of doing things, that they know how to do this-and-that other thing, totally unrelated on the job.

"I've studied the Martin-Löf's intuitionistic type theory."

"Great, how do you connect to our database."

"Uh ...."

"Next."

You'll bridle at this, but you know who agrees most strongly with me?

Ph.D.s

I went to the ICFP2006 specifically looking to roll dependent types into the programming language I was using, in industry, and I could not get the time of day from a single implementer of the type-theory in Twelf, and you know why?

"Why would you be interested in this? This is purely theoretical."

Uh, huh. As in "not applicable to industry."

I reread the paper again, later: "Dependent types make programs easier to understand and more reliable."

And why would I want that in my programs in industry, where it mattered.

I spent four years at the United States Coast Guard Academy: 10,000 students apply, only 300 are allowed in, only 150 graduate, each year. It cost, at the time, $250,000 to graduate a student from the Academy, making it the most expensive school in the nation.

Thank you, taxpayers, for my education.

I graduated with a dual major: mathematics and computer science.

How much of my education did I use on the job to save 150 lives from a capsized Arctic research exploration vessel (boy, they surely used their education, didn't they! ... to capsize their ship), act as the translator when we boarded Japanese trawlers, provide civil rights education and mediate EEO complaints and ...

None. Zip. Zilch.

After my stint, how much of my college education did I use on the job.

My job was encoding matrices in FORTRAN. How much FORTRAN did I study in college?

Zip. Zilch. Nada.

How much of the Advanced Calculus II did I use on the job.

People, it was frikken matrix manipulation! Something you can (now) look up on wikipedia and pick up in, oh, two hours if you're really slow.

Java. C#. Swift. Visual whatever. Spring. SQL. HBase. Angular. JavaScript.

All these things (Python, Ruby on Rails) can be taught in college, but they can be taught in high school, and I learned them in school, did I?

No, I did not. I learned them on my own, thank you very much.

Design patterns, frameworks, data structures. Do educated people know these things?

Some of them do. Most people with a 'computer science' degree DO NOT, people.

They do not. They woefully do not, as comp sci teachers lament over and over again, and as I, the hiring manager, scratch my head wondering what, precisely, did these kids learn in school, because, insofar as I see, they did not learn abstraction, polymorphism, typing, or data structures.

They learned the if-statement.

They learned the if-statement that n-dispatches within a for-loop from 1 to n off an array. That's the data structure they know: the array.

Maps? Sets?

The array.

Polymorphism?

We got you covered: the if-statement.

Functional decomposition?

Well, there's always main(String[] args), with a big-ole if-statement.

The word on the street is education is a canard at best and a detriment at most, and at worst, it's a project-sinker.

That's a shame, because there are educated people who are productive and smart and effective in their field, and can help.

How to Solve It: a Modern Approach claims that one billion dollars is wasted on software because it's written in the absence of very simple techniques, such as linear programming.

One.
Billion.
Dollars.

Our authors, Michalewicz and Fogel, are off. Way off. I know. By a factor of at least one-hundred.

We wasted a billion dollars on a file-indexing system for the FBI. Oh, it had email, too. Government project. Never used because it was never delivered in a useable state. Do you know how many go through that cycle?

I don't. I do know know I've seen project after project just ...

God. The waste.

And I have friends. And they tell me stories.

But, you get MITRE in there, or you get a Ph.D. or two in there, and what happens?

They study the issue.

They study it for six-plus months, and then they write you a nice little white paper that states the obvious search criteria that you knew from day one, but what do you have to say? Where is your ROC-analyses? So your bayesian system that was cranking out results month after month was killed by the bean-counting pointy-heads and they submit a ... working solution that could go into production? Oh, no. They submit a white paper calling for a research grant to allow for a year of surveying and further study of the issue.

God.

Then they get fired or they move on to more interesting research areas leaving behind us to clean up the mess and get a working system out the door in some serviceable shape that used zero percent of their research.

Zero percent.

You see, they modeled the situation, but the model doesn't fit the data, which is raw and dirty, so their solution solved the model, not your problem, not even close.

Your degree.

How much have you used your degree on your job?

If you're a researcher, you probably use quite a bit of what you've studied in your research, and you are contributing more to your field of study.

If you're not, then you're told this, day one, on your job: "Friend, put those books away, you're never going to use them again."

I mean, seriously: did you really bring your college books to your job thinking you'd use them?

NEEEERRRRRRD!

This, here, is the real world. The ivory tower is for the academics. In the real world, you roll up your sleeves, get to work, and get some results; because if you don't, the door is right over there.

You were expecting to use your degree on your job? This is America, people. We don' need no edjumakashun.

Now, if this were Soviet Russia, your degree uses you.

-----

So, silliness, and serious silliness aside.

Seriously.

You were expecting to use your degree on your job?

English major. This is America, we don't talk English, we talk American, so, that's nice that you have that degree.

Mathematics major. This is America, we don't do 'maths,' nor trig, nor geometric algebras, nor category theory, how would you use any of that on your job?

I was seriously asked that on my interview for a job overseeing a 1.7 petabyte-sized database.

I said: 'uh, map-reduce are straight from category theory.'

"Yes, but how do you use that on your job?"

We both blinked at each other dumbly.

The gulf.

You don't go to school to get trained to do a job well, ladies and gentlemen.

I mean, too many of you do that, and too many others go do school to party some, to sex some, to blaze some, and then get to work after your folks financed your four-plus year bacchanal.

College is not a technical training-institute and has nothing to do with acquiring skills or proficiency on repetitive stress disorder, oh, I meant: 'your job.' Your job, almost without exception, can be just as proficiently performed by nearly anyone they drag off the street and put in your chair for eight hours a day. They sit in your chair for a few days, and everyone else won't even know you're gone.

Most jobs.

My wife beat the pants off her entire payroll division with an excel spreadsheet because they didn't have simple accounting principles and deductive reasoning. Why? Because they were well-regulated at their jobs, proficient at it, in fact, and their job was to make continuous clerical errors because they had absolutely no rigor. Why would they? They weren't paid for rigor. They were paid for doing their jobs, which was: don't make waves.

I regularly go into situations where other software engineers (a misnomer, they are more like computer programmers, not engineers) say such-and-so cannot be done in programming language X.

Then, I implement a little bit of category theory, in programming language X, do some simple mappings and natural transformations, and, voilà! those 50,000 lines of code that didn't solve the problem but only made things worse? I replace all that with 500 lines of code that actually delivers the solution.

Unit tested: all the edge cases.

And meeting their requirements, because I've translated the requirements into a declarative DSL on top of their programming language X.

Of course they couldn't solve the insurmountable problem in programming language X, not because they were using programming language X (although it helped with the colossal fail being object-disoriented and improvably/mutatatively impure), but because they couldn't think outside the box that 'you can only do this and that' as a software engineer. They were caught in their own domain and can't even see that they had boxed themselves in.

Because they were educated that way. Comp Sci 101: this is how you write a program. This is the 'if'-statement. This is the for-loop. If that doesn't work, add more if-statements wrapped by more for-loops, and this statement is perfectly acceptable:

x = x + 1

Go to town.

That's what their education gave them: they went to school to acquire a trade and a proficiency at the if-statement, and gave up their ability to see and to think.

And some, many, academics are the most bigoted, most blundering blinders-on fools out there, because they see it their way, and they see their way as the only way, which requires a six-month research grant and further study after that.

With co-authorship on the American Mathematical Society journal article.

And the uneducated are the worst, most pigheaded fools out there, so sure that the educated have nothing to offer, that they have no dirt under their perfectly manicured fingernails attached silky smooth hands that have never seen an honest-day's work nor, God forbid! a callous, so what do they know, these blowhards, so the uneducated ignore the advances of research into type-theory, category theory, object theory (polymorphism does help at times), any theory, and just code and code and code until they have something that 'looks good.'

How to solve this?

Start with you.

Not with your education, that is: not with your education that tells you who you are.

Start with how you can help, and then help.


  • Project one: I saw how fractal dimensionality would solve a spectrum analysis problem. Did I say the words 'fractal' or 'dimensions'? No. I was working with real-programmers. If I asked if I could try this, do you know what they would say?

    Pfft. Yeah, right. Get back to work, geophf!

    But, instead, I implemented the algorithm. I sat with a user who had been working on those signals and knew what he needed, iterated through the result a week.

    Just a week. While I did my job-job full time. I did the fractal spectrum analysis on my own time.

    My 'thing' floored the software management team. They had seen straight-line approximations before. They thought I was doing actual signal analysis. I mean: with actual signals.

    They showed my 'thing' to the prospective customer. And got funded.


  • Another project: data transformation and storage, built a system that encompassed six-hundred data elements using a monadic framework to handle the semideterminism. That was an unsolvable problem in Java.

    I used Java.

    Java with my monadic framework, yes, but Java, to solve the problem.


  • Third project: calculating a 'sunset date' over a data vector of dimension five over a time continuum.

    Hm: continuum.

    Unsolvable problem. Three teams of software developers tackled it over six months. Nobody could get close to the solution.

    Continuum.

    I used a comonadic framework.

    Took me, along with a tester who was the SME on the problem, and a front-end developer to get the presentation layer just right, about a month, and we solved that baby and put it to bed.

    Unit tested. All edge cases.

    Did I tell them I used a comonadic framework?

    Nah, they tripped over themselves when they saw the word 'tuple.'

    No joke, my functional programming language friends: they, 'software engineers,' were afraid of the word 'tuple.'

    So I explained as much as anyone wanted to know when anyone asked. I wrote design documents, showing unit test case results, and they left me alone. They knew I knew what I was doing, and I got them their results. That's what they needed.

    They didn't need my degree.

    They didn't need to know I used predicate logic to optimize SQL queries that took four hours to run to a query that took forty-five seconds.

    They didn't need to know I refactored using type theory, that A + B are disjoint types and A * B are type instances and A ^ B are function applications so I could look at a program, construct a mathematical model of it and get rid of 90% of it because it was all redundantly-duplicated code inside if-clauses, so I simply extracted (2A + 2B ... ad nauseam) to 2(A + B ...) and then used a continuation, for God's sake, with 'in the middle of the procedure' code, or, heaven help me, parameterization over a simple functional decomposition exercise to reduce a nightmare of copy-and-paste to something that had a story to tell that made sense.

How do you connect to a database?

Do you need a college degree for that?

Kids with college degrees don't know the answer to that simple interview question.

And they don't know the Spring framework, making 'how to connect to a database' a stupid-superfluous question.

They don't know what unit tests give them. They don't know what unit tests don't give them. Because they, college kids and crusty old 'software engineers,' don't write them, so they have no consistency nor security in their code: they can't change anything here because it might break something over there, and they have no unit tests as a safety net to provide that feedback to them, and since they are programming in language X, a nice, strict, object-oriented programming language, they have no programs-as-proofs to know that what they are writing is at all good or right or anything.

A college degree gives you not that. A not college degree gives you not that.

A college degree is supposed to what, then?

It's suppose to open your mind to the possibility of a larger world, and it's supposed to give you the tools to think, and to inquire, so that you can discern.

"This, not that. That, and then this. This causes that. That is a consequence of this. I choose this for these reasons. These reasons are sound because of these premises. This reason here. Hm. I wonder about that one. It seems unsound. No: unfamiliar. Is it sound or unsound? Let me find out and know why."

English. Mathematics. Art. Literature. Music. Philosophy. All of these things are the humanities. The sciences and the above. Law. Physics. All these lead one to the tools of inquiry.

In school, you are supposed to have been given tools to reason.

Then, you're sent back out into the world.

And then you are supposed to reason.

And with your reason, you make the world a better place, or a worse place.

These things at school, these are the humanities, and they are there to make you human.

Not good at your job, not so you can 'use' your degree as a skill at work, but to make you human.

And, as human, are you good at your job?

Yes.

And, as human, do you make your world a place such that others are good and happy at their jobs?

Yes.

The end of being human is not to be skilled, nor proficient ... 'good' at your job.

But it's an accident of it, a happy accident.

The 'end' of being human?

Well: that's your inquiry.

That's what school, that's what everything, is for: for you to answer the unanswered question.

Your way.

And, if you accept that, and are fully realized as a human being, then your way is the best way in the world, and your way has the ability to change lives. First, your own, then others. Perhaps your coworkers.

Perhaps hundreds of others.

Perhaps thousands.

Perhaps you will change the entire world.

But you won't know that until you take that first step of inquiry.

Then the next.

Then the next.

And you look back, and you see how far you've come, and ... wow.

Just wow.

That's what school is for. Not for your job.

For you.
Categories: Offsite Blogs

Using lenses with Vector, IORef, MVar and TVar?

Haskell on Reddit - Mon, 08/04/2014 - 5:39am

Most lens tutorials etc. talk about the well-known record, tuple, traversable and StateT usages. One place in Haskell where I'd really like a similar concise and elegant syntax is mutating vectors and dealing with IORef/MVar/TVar. Basically, something like this

ref <- newIORef 0 :: IO (IORef Int) ref +~ 5

and this

v <- VM.new 10 :: IO (VM.IOVector Int) v & at 1 +~ 5

But there doesn't seem to be any support for such uses in lens. Now, lens is a fairly large library and the above seems rather obvious, so I wonder if there is some deeper reason why such functionality not included? If working with these IO/ST/STM constructs can't be cleanly integrated with lens, is there another library providing some combinators and syntactic sugar for things like modifyIORef ref (+ 5) and VM.read v 1 >>= return . (+ 5) >>= VM.write v 1?

submitted by SirRockALot1
[link] [19 comments]
Categories: Incoming News

Can anyone give any references on Naperian/logarithmic datatypes?

Haskell on Reddit - Mon, 08/04/2014 - 2:33am

I've been reading the Gibbons' and Oliviera's iterator paper and stumbled across an intriguing passage:

A similar construction works for any fixed-shape datatype: pairs, vectors of length n, matrices of fixed size, infinite binary trees, and so on. Peter Hancock calls such datatypes Naperian, because they support a notion of logarithm. That is, datatype t is Naperian if t a ≃ ap ≃ p → a for some type p of positions, called the logarithm log t of t. Then t 1 ≃ 1p ≃ 1, so the shape is fixed, and familiar properties of Napier’s logarithms arise — for example, log (t × u) ≃ log t + log u. Naperian functors generally are equivalent to Reader monads, with the logarithm as environment; nevertheless, we feel that it is worth identifying this particular subclass of monadic applicative functors as worthy of special attention.

Unfortunately, the paper doesn't provide any references on that. Does anyone know where I can read more on logarithmic types?

submitted by aicubierre
[link] [13 comments]
Categories: Incoming News

Let me start a discussion: What is the main cause of the `cabal hell`?

Haskell on Reddit - Mon, 08/04/2014 - 12:54am

Okay, I will list some items first.

  • newer version of some package is not compatible with the old version: package dependencies comes with >a.b.c & <d.e.f rather than >=a.b.c
  • only one version is active (unlike in nixos)
  • cabal sandbox is not so comfortable to use (when you want to load it in ghci)

Below is the explanation.

  • If package A depends on B and all the newer version of B in a long time, B will not be a problem.
  • If we can have multiple versions, we won't care about cabal hell.
  • If the cabal sandbox is more comfortable to use, we will feel better.

I am not sure if this will be helpful for future considerations on how to write a package dependency. But I think this will help understanding where the problem lies, which is the first step to solve one problem.

submitted by eccstartup
[link] [14 comments]
Categories: Incoming News

wren gayle romano: On my pulling away from Haskell communities

Planet Haskell - Sun, 08/03/2014 - 8:32pm

Gershom Bazerman gave some excellent advice for activism and teaching. His focus was on teaching Haskell and advocating for Haskell, but the advice is much more widely applicable and I recommend it to anyone interested in activism, social justice, or education. The piece has garnered a good deal of support on reddit— but, some people have expressed their impression that Gershom's advice is targeting a theoretical or future problem, rather than a very concrete and very contemporary one. I gave a reply there about how this is indeed a very real issue, not a wispy one out there in the distance. However, I know that a lot of people like me —i.e., the people who bear the brunt of these problems— tend to avoid reddit because it is an unsafe place for us, and I think my point is deserving of a wider audience. So I've decided to repeat it here:

This is a very real and current problem. (Regardless of whether things are less bad in Haskell communities than in other programming communities.) I used to devote a lot of energy towards teaching folks online about the ideas behind Haskell. However, over time, I've become disinclined to do so as these issues have become more prevalent. I used to commend Haskell communities for offering a safe and welcoming space, until I stopped feeling quite so safe and welcomed myself.

I do not say this to shame anyone here. I say it as an observation about why I have found myself pulling away from the Haskell community over time. It is not a deliberate act, but it is fact all the same. The thing is, if someone like me —who supports the ideology which gave rise to Haskell, who is well-educated on the issues at hand, who uses Haskell professionally, who teaches Haskell professionally, and most importantly: who takes joy in fostering understanding and in building communities— if someone like me starts instinctively pulling away, that's a problem.

There are few specific instances where I was made to feel unsafe directly, but for years there has been a growing ambiance which lets me know that I am not welcome, that I am not seen as being part of the audience. The ambiance (or should I say miasma?) is one that pervades most computer science and programming/tech communities, and things like dogmatic activism, dragon slaying, smarter-than-thou "teaching", anti-intellectualism, hyper-intellectualism, and talking over the people asking questions, are all just examples of the overarching problem of elitism and exclusion. The problem is not that I personally do not feel as welcomed as I once did, the problem is that many people do not feel welcome. The problem is not that my experience and expertise are too valuable to lose, it's that everyone's experience and expertise is too valuable to lose. The problem is not that I can't teach people anymore, it's that people need teachers and mentors and guides. And when the tenor of conversation causes mentors and guides to pull away, causes the silencing of experience and expertise, causes the exclusion and expulsion of large swaths of people, that always has an extremely detrimental impact on the community.

Twitter Facebook Google+ Tumblr WordPress

comments
Categories: Offsite Blogs

wren gayle romano: On my pulling away from Haskell communities

Planet Haskell - Sun, 08/03/2014 - 8:30pm

Gershom Bazerman gave some excellent advice for activism and teaching. His focus was on teaching Haskell and advocating for Haskell, but the advice is much more widely applicable and I recommend it to anyone interested in activism, social justice, or education. The piece has garnered a good deal of support on reddit— but, some people have expressed their impression that Gershom's advice is targeting a theoretical or future problem, rather than a very concrete and very contemporary one. I gave a reply there about how this is indeed a very real issue, not a wispy one out there in the distance. However, I know that a lot of people like me —i.e., the people who bear the brunt of these problems— tend to avoid reddit because it is an unsafe place for us, and I think my point is deserving of a wider audience. So I've decided to repeat it here:

This is a very real and current problem. (Regardless of whether things are less bad in Haskell communities than in other programming communities.) I used to devote a lot of energy towards teaching folks online about the ideas behind Haskell. However, over time, I've become disinclined to do so as these issues have become more prevalent. I used to commend Haskell communities for offering a safe and welcoming space, until I stopped feeling quite so safe and welcomed myself.

I do not say this to shame anyone here. I say it as an observation about why I have found myself pulling away from the Haskell community over time. It is not a deliberate act, but it is fact all the same. The thing is, if someone like me —who supports the ideology which gave rise to Haskell, who is well-educated on the issues at hand, who uses Haskell professionally, who teaches Haskell professionally, and most importantly: who takes joy in fostering understanding and in building communities— if someone like me starts instinctively pulling away, that's a problem.

There are few specific instances where I was made to feel unsafe directly, but for years there has been a growing ambiance which lets me know that I am not welcome, that I am not seen as being part of the audience. The ambiance (or should I say miasma?) is one that pervades most computer science and programming/tech communities, and things like dogmatic activism, dragon slaying, smarter-than-thou "teaching", anti-intellectualism, hyper-intellectualism, and talking over the people asking questions, are all just examples of the overarching problem of elitism and exclusion. The problem is not that I personally do not feel as welcomed as I once did, the problem is that many people do not feel welcome. The problem is not that my experience and expertise are too valuable to lose, it's that everyone's experience and expertise is too valuable to lose. The problem is not that I can't teach people anymore, it's that people need teachers and mentors and guides. And when the tenor of conversation causes mentors and guides to pull away, causes the silencing of experience and expertise, causes the exclusion and expulsion of large swaths of people, that always has an extremely detrimental impact on the community.

Twitter Facebook Google+ Tumblr WordPress

comments
Categories: Offsite Blogs

"Standardising" Haskell AST for tooling

haskell-cafe - Sun, 08/03/2014 - 8:27pm
Hi all I am looking at updating HaRe for GHC 7.8.3, and I am fighting my way through the AST changes. One of the things I have had at the back of my mind for a while is to use something like Kure universes or more generally lens to provide a set of isomorphisms from the various flavours of AST into some kind of standardised internal representation, allowing easier tool manipulation. This could potentially decouple the tools from the specific compiler/analyzer, so they could work across GHC 7.6.x, GHC 7.8.x, haskell-src-exts, haste, etc.. Obviously there would be limitations to this where an advance in the language brings in new features, but a lot of useful tool work can be done that does not touch the new stuff. I don't know if anything similar is planned in either ghc-server or another toolchain. My haskell-token-utils is a first limited attempt to bring source code round tripping to a variety of backends, but a more general solution to the AST phase would help tooling in general So, is this worth d
Categories: Offsite Discussion

Thiago Negri: Code reuse considered harmful

Planet Haskell - Sun, 08/03/2014 - 3:24pm

The title is intended to call for attention. This post is about one perspective of software development in the light of my own experience in the area, it won't contain anything really revealing and is not to be taken as an absolute true for life. It's a rant. I hope you have a good time reading it, feel free to leave me any kind of feedback.

I see a bunch of people praising reuse as being the prime thing of good software development, and few talking about replaceability. There seems to be a constant seek to avoid writing code that is used only once, as if it was a really bad thing. Then we end up with software that is made of conceptual factories that create factories that create the things the software really needs, yes there are two levels of factories, or more. Is this really necessary? How much time do we save by this extreme look for reusing code?

First, let me ask and answer a simple question: why duplicated code is annoying? Well, duplicated code makes it harder to change stuff. When you have the same piece of code written multiple times in a code base and you find that it needs a change, e.g. bug fix or new feature, you will need to change it in all places. Things can get worst if you don't know all places where the code is duplicated, so you may forget to change one of these spots. The result is that duplicated code is a sign of harder maintenance and a fertile ground for further bugs to spawn. That's why we learned to hate it. We started fighting this anti-pattern with all strength we had.

Code reuse is the perfect counter to code duplication, right? Sure, it is right, if we reuse a piece of code in two places, we have no duplication between these places. So, we did it! We found the Holy Grail of code quality, no more duplicated code, yay! But something unintended happened. Remember the old saying: with great powers, comes great responsibility. People started to be obsessed with it. As soon as they learned to use the hammer of code reuse, everything turned into a nail, when it didn't work out in the first hit, they adjust the size of the hammer and hit it again with more effort.

This seek after code reuse led us to a plethora of abstractions that seems to handle every problem by reusing some code. Don't get me wrong, lots of them are useful, these are the ones that were created from observation. The problem is the ones that are created from "it's cool to abstract", or other random reason that is not true observation. We see frameworks after frameworks that try to fit every problem of the world into a single model. Developers learn to use these frameworks and suddenly find out that the framework creator is wrong and create yet another abstraction over it or creates yet another framework that tries to use a different model to solve the world.

What happens when we have a bug in one of these abstractions or we need to enhance it? Silence, for a while, then the sky turns black, you take a break, go for a walk, come back to your computer and start blaming the other developer that created the bug or that "got the abstraction wrong", because your vision was the right one. What happened? We reused code to avoid code duplication, but we are still having the same problems: code that is hard to maintain and evolve.

My guess? We missed the enemy. Code duplication is not our enemy. Maintenance problem and rigidity of code is.

My tip? Give more focus on replaceability of code instead of reuse in your talks, codes, classes, etc. Create the right abstraction to fix the problem at hand in a way that is easy to replace the underlying code when needed. Some time in the future, you will need to change it anyway. That's what agile methodologies try to teach us: embrace change. Planning for a design to be reused says: "my design will be so awesome, that I will reuse it everywhere." That's what agile says: "your design will need to change sometime, because the requirements will change, plan for the replaceability of it." People are doing things like service oriented architecture in the wrong way because they are looking for reuse of services and not for replaceability of services, they end up with a Big Web of Mud.

That's all folks. Thanks for your time.

Categories: Offsite Blogs

Is there any way to download the Haskell Wiki to read offline (PDF or Mobi)?

Haskell on Reddit - Sun, 08/03/2014 - 3:22pm

Title.

(Sorry for asking 3 questions in a row today.)

submitted by SrPeixinho
[link] [5 comments]
Categories: Incoming News

Is there any refactoring tool for Haskell?

Haskell on Reddit - Sun, 08/03/2014 - 2:47pm

Is there any refactoring tool for haskell? Things such as:

  • Cross-modules variable renaming.
  • do notation to chain of >>=
  • foo = let a=b in c to foo = c where a = b
  • less/more point-free
  • foo = \x → x to foo x = x back and forth
  • and so on
submitted by SrPeixinho
[link] [13 comments]
Categories: Incoming News

[ANN] Hayoo Relaunch

haskell-cafe - Sun, 08/03/2014 - 2:13pm
Hi Cafe, Hayoo <http://hayoo.fh-wedel.de> has been relaunched. Hayoo is a search engine for Hackage packages, which allows you to search for functions, data types and packages. It is currently work in progress. Any feedback is greatly appreciated! Hayoo uses Hunt <https://github.com/hunt-framework> for indexing and searching, which is the successor of Holumbus. Hunt is a flexible, lightweight search platform with a powerful query language and JSON API. Example search requests are: * Function names: map <http://hayoo.fh-wedel.de/?query=map> * Function signatures: (a->b)->f a->f b <http://hayoo.fh-wedel.de/?query=%28a-%3Eb%29-%3Ef+a-%3Ef+b> * Module names: Control.Loop <http://hayoo.fh-wedel.de/?query=Control.Loop> Have a look at the examples on <http://hayoo.fh-wedel.de/examples> for some advances queries. The old Hayoo and Holumbus are still online at <http://holumbus-alt.fh-wedel.de/>
Categories: Offsite Discussion

http://www.downforeveryoneorjustme.com/haskell.org

haskell-cafe - Sun, 08/03/2014 - 1:52pm
Thinks always break on the weekend, don’t they! Apologies if this is a scheduled outtake. In the meantime, there’s fortunately a Haddock mirror on http://haddocks.fpcomplete.com/fp/7.7/20131212-1/ ;-) Cheers, Tim
Categories: Offsite Discussion

Is there any way to elegantly represent this pattern in Haskell?

Haskell on Reddit - Sun, 08/03/2014 - 12:07pm

Mind the pure function below, in an imperative language:

def foo(x,y): x = f(x) if a(x) if c(x): x = g(x) else: x = h(x) x = f(x) y = f(y) if a(y) x = g(x) if b(y) return [x,y]

That function represents a style where you have to incrementally update variables. It can be avoided in most cases, but there are situations where that pattern is unavoidable - for example, writing a cooking procedure for a robot, which inherently requires a series of steps and decisions. Now, imagine we were trying to represent foo in Haskell.

foo x0 y0 = let x1 = if a x0 then f x0 else x0 in let x2 = if c x1 then g x1 else h x1 in let x3 = f x2 in let y1 = if a y0 then f y0 else y0 in let x4 = if b y1 then g x3 else x3 in [x4,y1]

That code works, but it is too complicated and error prone due to the need for manually managing the numeric tags. Notice that, after x1 is set, x0's value should never be used again, but it still can. If you accidentally use it, that will be an undetected error.

I've managed to solve this problem using the State monad:

fooSt x y = execState (do (x,y) <- get when (a x) (put (f x, y)) (x,y) <- get if c x then put (g x, y) else put (h x, y) (x,y) <- get put (f x, y) (x,y) <- get when (a y) (put (x, f y)) (x,y) <- get when (b y) (put (g x, x))) (x,y)

This way, need for tag-tracking goes away, as well as the risk of accidentally using an outdated variable. But now the code is verbose and much harder to understand, mainly due to the repetition of (x,y) <- get.

So: what is a more readable, elegant and safe way to express this pattern?

Full code for testing.

SO cross-post.

submitted by SrPeixinho
[link] [42 comments]
Categories: Incoming News