# News aggregator

### WebHome < Afp0607 < UUCS

### WebHome < Afp0607 < UUCS

### Java's Interface and Haskell's type class: differences and similarities? - Stack Overflow

### Java's Interface and Haskell's type class: differences and similarities? - Stack Overflow

### haskell - Difference between OOP interfaces and FP type classes - Stack Overflow

### haskell - Difference between OOP interfaces and FP type classes - Stack Overflow

### NewTypes Aren't As Cool As You Think

### CIS 194 -Intro to Haskell

### Zélus : A Synchronous Language with ODEs

Zélus : A Synchronous Language with ODEs

Timothy Bourke, Marc Pouzet

2013

Zélus is a new programming language for modeling systems that mix discrete logical time and continuous time behaviors. From a user's perspective, its main originality is to extend an existing Lustre-like synchronous language with Ordinary Differential Equations (ODEs). The extension is conservative: any synchronous program expressed as data-flow equations and hierarchical automata can be composed arbitrarily with ODEs in the same source code.

A dedicated type system and causality analysis ensure that all discrete changes are aligned with zero-crossing events so that no side effects or discontinuities occur during integration. Programs are statically scheduled and translated into sequential code that, by construction, runs in bounded time and space. Compilation is effected by source-to-source translation into a small synchronous subset which is processed by a standard synchronous compiler architecture. The resultant code is paired with an off-the-shelf numeric solver.

We show that it is possible to build a modeler for explicit hybrid systems à la Simulink/Stateflow on top of an existing synchronous language, using it both as a semantic basis and as a target for code generation.

Synchronous programming languages (à la Lucid Synchrone) are language designs for reactive systems with discrete time. Zélus extends them gracefully to hybrid discrete/continuous systems, to interact with the physical world, or simulate it -- while preserving their strong semantic qualities.

The paper is short (6 pages) and centered around examples rather than the theory -- I enjoyed it. Not being familiar with the domain, I was unsure what the "zero-crossings" mentioned in the introductions are, but there is a good explanation further down in the paper:

The standard way to detect events in a numeric solver is via zero-crossings where a solver monitors expressions for changes in sign and then, if they are detected, searches for a more precise instant of crossing.

The Zélus website has a 'publications' page with more advanced material, and an 'examples' page with case studies.

### Mark Jason Dominus: Within this instrument, resides the Universe

When opportunity permits, I have been trying to teach my ten-year-old daughter rudiments of algebra and group theory. Last night I posed this problem:

Mary and Sue are sisters. Today, Mary is three times as old as Sue; in two years, she will be twice as old as Sue. How old are they now?

I have tried to teach Ms. 10 that these problems have several phases. In the first phase you translate the problem into algebra, and then in the second phase you manipulate the symbols, almost mechanically, until the answer pops out as if by magic.

There is a third phase, which is pedagogically and practically essential. This is to check that the solution is correct by translating the results back to the context of the original problem. It's surprising how often teachers neglect this step; it is as if a magician who had made a rabbit vanish from behind a screen then forgot to take away the screen to show the audience that the rabbit had vanished.

Ms. 10 set up the equations, not as I would have done, but using four unknowns, to represent the two ages today and the two ages in the future:

$$\begin{align} MT & = 3ST \\ MY & = 2SY \\ \end{align} $$

( here is the name of a single variable, not a product of and ; the others should be understood similarly.)

“Good so far,” I said, “but you have four unknowns and only two equations. You need to find two more relationships between the unknowns.” She thought a bit and then wrote down the other two relations:

$$\begin{align} MY & = MT + 2 \\ SY & = ST + 2 \end{align} $$

I would have written two equations in two unknowns:

$$\begin{align} M_T & = 3S_T\\ M_T+2 & = 2(S_T + 2) \end{align} $$

but one of the best things about mathematics is that there are many
ways to solve each problem, and no method is privileged above any
other except perhaps for reasons of practicality. Ms. 10's translation
is different from what I would have done, and it requires more work in
phase 2, but it is correct, and I am not going to tell her to do it my
way. The method works *both* ways; this is one of its best features.
If the problem can be solved by thinking of it as a problem in two
unknowns, then it can *also* be solved by thinking of it as a problem
in four or in eleven unknowns. You need to find more relationships,
but they must exist and they can be found.

Ms. 10 may eventually want to learn a technically easier way to do it, but to teach that right now would be what programmers call a premature optimization. If her formulation of the problem requires more symbol manipulation than what I would have done, that is all right; she needs practice manipulating the symbols anyway.

She went ahead with the manipulations, reducing the system of four
equations to three, then two and then one, solving the one equation to
find the value of the single remaining unknown, and then substituting
that value back to find the other unknowns. One nice thing about these
simple problems is that when the solution is correct you can see it at
a glance: Mary is six years old and Sue is two, and in two years they
will be eight and four. Ms. 10 loves picking values for the unknowns
ahead of time, writing down a random set of relations among those
values, and then working the method and seeing the correct answer pop
out. I remember being endlessly delighted by almost the same thing
when I was a little older than her. In *The Dying Earth* Jack Vance
writes of a wizard who travels to an alternate universe to learn from
the master “the secret of renewed youth, many spells of the ancients,
and a strange abstract lore that Pandelume termed ‘Mathematics.’”

“I find herein a wonderful beauty,” he told Pandelume. “This is no science, this is art, where equations fall away to elements like resolving chords, and where always prevails a symmetry either explicit or multiplex, but always of a crystalline serenity.”

After Ms. 10 had solved this problem, I asked if she was game for something a little weird, and she said she was, so I asked her:

Mary and Sue are sisters. Today, Mary is three times as old as Sue; in two years, they will be the same age. How old are they now?

“WHAAAAAT?” she said. She has a good number sense, and immediately
saw that this was a strange set of conditions. (If they aren't the
same age now, how can they be the same age in two years?) She asked
me what would happen. I said (truthfully) that I wasn't sure, and
suggested she work through it to find out. So she set up
the equations as before and worked out the solution, which is obvious
*once you see it*: Both girls are zero years old today, and zero is
three times as old as zero. Ms. 10 was thrilled and delighted, and
shared her discovery with her mother and her aunt.

There are some powerful lessons here. One is that the method works even when the conditions seem to make no sense; often the results pop out just the same, and can sometimes make sense of problems that seem ill-posed or impossible. Once you have set up the equations, you can just push the symbols around and the answer will emerge, like a familiar building approached through a fog.

But another lesson, only hinted at so far, is that mathematics has its own way of understanding things, and this is not always the way that humans understand them. Goethe famously said that whatever you say to mathematicians, they immediately translate it into their own language and then it is something different; I think this is exactly what he meant.

In this case it is not too much of a stretch to agree that Mary is three times as old as Sue when they are both zero years old. But in the future I plan to give Ms. 10 a problem that requires Mary and Sue to have negative ages—say that Mary is twice as old as Sue today, but in three years Sue will be twice as old—to demonstrate that the answer that pops out may not be a reasonable one, or that the original translation into mathematics can lose essential features of the original problem. The solution that says that is mathematically irreproachable, and if the original problem had been posed as “Find two numbers such that…” it would be perfectly correct. But translated back to the original context of a problem that asks about the ages of two sisters, the solution is unacceptable. This is the point of the joke about the spherical cow.

### amazonka - Comprehensive Amazon Web Services SDK

Despite there already being a few pre-existing AWS libraries already on Hackage, I've recently worked on open sourcing an approach to auto-generating the full SDK in the same manner as Amazon's official Java, .NET, Ruby, and Python bindings.

I wrote a little overview about the motivation and reasoning here.

While they're not ready for prime time, I hope releasing them into wild would provide me with constructive feedback and additional motivation to get these to a level that rival the SDKs available for other languages, and make Haskell even more viable for those of us interested in writing Infrastructure and Cloud related tooling in Haskell.

Until either Hackage builds the documentation, or I manually upload it, you can view the collective Haddock here.

The full suite of supported services is:

- amazonka-autoscaling
- amazonka-cloudformation
- amazonka-cloudfront
- amazonka-cloudsearch-domains
- amazonka-cloudsearch
- amazonka-cloudtrail
- amazonka-cloudwatch-logs
- amazonka-cloudwatch
- amazonka-codedeploy
- amazonka-cognito-identity
- amazonka-cognito-sync
- amazonka-config
- amazonka-datapipeline
- amazonka-directconnect
- amazonka-dynamodb
- amazonka-ec2
- amazonka-elasticache
- amazonka-elasticbeanstalk
- amazonka-elastictranscoder
- amazonka-elb
- amazonka-emr
- amazonka-iam
- amazonka-importexport
- amazonka-kinesis
- amazonka-kms
- amazonka-lambda
- amazonka-opsworks
- amazonka-rds
- amazonka-redshift
- amazonka-route53-domains
- amazonka-route53
- amazonka-s3
- amazonka-sdb
- amazonka-ses
- amazonka-sns
- amazonka-sqs
- amazonka-storagegateway
- amazonka-sts
- amazonka-support
- amazonka-swf

[link] [16 comments]