I have the following line of codemapM_ (\uid -> printEmailAddress connection uid) (reverse messageList)
The compiler gives me the following warningWarning: Avoid lambda Found: \ uid -> printEmailAddress connection uid Why not: printEmailAddress connection
Now, I understand the warning completely from a technical perspective but it seems to me that the statement becomes much less clear if the parameter is removed so is this really a good thing to warn about? If so, why?submitted by dhjdhj
[link] [42 comments]
Shower thought: would an efficient supercompiler make ad-hoc static type systems possible in a dynamically typed language?
I've been thinking, suppose we had an efficient supercompiler in a dynamic language (say, an untyped dialect of Haskell). Then, we could simulate types with tagged values.TypeError = symbol Correct = symbol Int = symbol Double = symbol check TypeError expr = TypeError check Correct expr = expr tagInt num = (Int, num) isInt (Int,_) = Correct isInt _ = TypeError tagDouble num = (Double, num) isDouble (Double,_) = Correct isDouble _ = TypeError let addDoubles x y = check (isDouble x) (check (isDouble y) (x + y)) let program x = addDoubles (tagDouble 3.0) (tagInt x)
If this program was fully supercompiled, it would in inevitably result in:program x = TypeError
So we know our program won't typecheck when it supercompiles to TypeError! But if you supercompile this:program x = add (tagDouble 3.0) (tagDouble x)
This would be supercompiled to:program x = 3.0 + x
That is, we got rid of the runtime checking, like a static type system should do. Of course, you would need a few ad-hoc syntax sugars to simulate Haskell's syntax, but, functionally speaking, am I correct in thinking supercompilation would allow ad-hoc type systems?
Edit: codesubmitted by SrPeixinho
[link] [6 comments]
I don't understand why I followed a simple GUI install and yet GHC 7.8 wasn't installed. I have already uninstall-hs --remove all from my computer. Attempting to start from scratch. I'll try to download the .tar.bz file again but when building it the gwd-pwd executable binary file WON'T EXECUTE. So I can't even ./configure . Anyone else run into this or know of a way to work around this?submitted by dgomez1092
[link] [3 comments]
Our December meetup's lightning talks are up on youtube.
The individual breakdown:
Darius Jahandarie - Rust for Haskellers
Elliot Stern - Fun with Phantoms
William Blair - Debugging with types in ATS
Tom Titchener - Building a real simple music generator to parameterize canons
Edward Kmett - Encapsulation vs. Code Reuse
Enjoy!submitted by imalsogreg
[link] [8 comments]
Two research assistantships in model-driven engineeringand semantic technologies, University of Oxford
A function f :: A -> B -> C can be applied in infix form where:a `f` b <=> f a b
I think this is a mistake and that it should instead have been:a `f` b <=> f b a
sepBy (from Parsec) is a typical example of the problem. In Haskell we can either write:p `sepBy` (symbol ",")
or:sepBy p (symbol ",")
But the second form looks strange and swapping the arguments would make the infix form look strange instead.
A similar example is asTypeOf. Consider:asTypeOf 1 int
It looks wrong because, like sepBy, it is made to appear natural when used in infix form:1 `asTypeOf` int
If `f` = flip f this would not have been a problem. This would also allow the familiar object-method syntax (for those who like that):[1,2,3] `map` f <=> map f [1,2,3] 'A' replicate 5 <=> replicate 5 'A' m `lookup` 'b' <=> lookup 'b' m 5 `mod` 2 <=> mod 2 5
Note that mod 2 would be a modulo 2 function, which IMO is more intuitive than a function taking 2 modulo something.
My wish was that infix function application should flip it's arguments to rid strange things like this:subtract 2 5 == 3 -- good 5 `subtract` 2 == -3 -- what?
This discussion has given me insights to change my mind on this. Here is why.
First, some really good counter examples came up. Functions like zip and mappend works fine as things are now:mappend [1,2] [3,4] == [1,2,3,4] == [1,2] `mappend` [3,4]
Flipping the arguments for the infix form would make it awkward.
Then it was pointed out that(&) = flip ($)
can be used to "infix" a function to it's flipped form, so that5 &subtract 2 == 3
as expected. (Compared to the infix form)
Also & is to be added to Data.Function (to my understanding) so will became standardized.
This means we can both eat the cake and have it too!
Still, I maintain that some functions such as mod and sepBy have their arguments in wrong order. Even more so when & comes along. I agree with fridofrido that argument order should by convention be driven by the pattern of partial application.submitted by togrof
[link] [79 comments]
Green energy / IoT startup Moixa Technology is seeking to add to our software team.
We're a small team dedicated to developing technology that enables a radical change in the way that energy is used in the home. We are just ramping up to deliver a project (working with large energy companies) demonstrating how communities can use the Maslow system across a group of homes to share energy in that community. We will need to deploy software that addresses some challenging problems to make this possible.
The code that we develop is built around providing services based on the hardware systems that we are deploying and so needs to work with the constraints and characteristics of the hardware & low level firmware we have built.
We're looking for individuals with generalist approach that are willing and and able to participate in all aspect of design, implementation and operation of our platform. The candidate must be happy in a small team, and also able to work autonomously. We are expanding as we ramp up to deliver the next generation of control software to our increasing number of deployed system. This is an exciting moment for the company.
- Design & implemetation of all parts of our software stack (web frontend & backend, data analytics, high-level code on IoT devices)
- Operations support (expected <20% of time)
Our current stack involves:
- Scala (Akka, Play) / ClojureScript / Haskell
- Postgres, neo4j
- Raspberry PI / Arch Linux
- PIC32 microcontroller / C
Skills and Requirements:
- Experience in one or more functional languages
- Familiarity with at least one database paradigm
- Linux scripting and operation
- Familiarity with (strongly) typed functional languages (Haskell/ML/Scala)
- Embedded programming experience
- Experience in data analytics (Spark or similiar)
- Experience in IoT development
- Open Source contributions
Moixa technology is based in central London (Primrose Hill), Salary depending on experience + performance based share options.
Get information on how to apply for this position.