News aggregator


Haskell on Reddit - Fri, 06/12/2015 - 12:21pm
Categories: Incoming News

Rewriting a function in CAF (constant applicative form)

Haskell on Reddit - Fri, 06/12/2015 - 12:02pm

I read that Haskell will only remember the results of a call to a function if the function is in CAF (as opposed to being a lambda expression with variables).

I'm trying to rewrite some code in this form so that more of my functions become "memoized".

I was wondering: can all functions be written in CAF?

Let's say I had this function below, how would it look in CAF ?

f arg1 arg2 = map (\x-> someFunction x arg1 ) arg2

submitted by asswaxer
[link] [8 comments]
Categories: Incoming News

How to figure out which FRP library to use?

Haskell on Reddit - Fri, 06/12/2015 - 10:58am

There's so many FRP libs, and as someone totally new to the concept and wanting to learn, I don't even know enough to understand the differences. What do ordered, continuous and discrete mean? Do I want arrows or not? Is there a simple introduction to these concepts somewhere? Note that I am not asking which library to use, I found plenty of answers to that but it is all "I like Foo, use it". I am more interested in learning enough to answer the question for myself.

submitted by I4dcQsEpLzTHvD1qhlDE
[link] [48 comments]
Categories: Incoming News

Avoiding Generic Programming Overzealousness

Haskell on Reddit - Fri, 06/12/2015 - 9:53am

When I was a C++ programming, I got into template meta programming and it was awesome. I eventually realized that overdoing it can really make a mess.

Now, I gotten into GHC.Generics and TemplateHaskell and I'm loving it. I find that they can really simplify code nicely. In my current project, I find myself adding genetic code occasionally and I'm hoping that I'm not introducing maintenance nightmares for myself down the line. Does anyone have guidelines on when to avoid writing that kind of genetic code?

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

Haskell in Vietnam?

haskell-cafe - Fri, 06/12/2015 - 9:25am
Dear all, I would like to get in touch with people learning, teaching or using Haskell in Vietnam. Can anyone on this list help me? Thanks, Tom
Categories: Offsite Discussion

Add IsNumeric (similar to IsString and IsList)

haskell-cafe - Fri, 06/12/2015 - 8:04am
Hi Cafe! Now that we have OverloadedList and OverloadedStrings extensions it might make sense to add something similar for numerals - right now if you want to be able to specify some items as numbers you have to implement Num instance, unfortunately not everything that can be represented as number can have sensible operations required by Num: negation makes no sense for set of natural numbers for example, multiplication for some applications of currency values which results in Num instance full of (*) = error "No multipication for Foos", (+) = error "No addition for Foos". I don't have any statistics from hackage or github, but in codebase I'm working with there are 3 such instances. Proposal: add OverloadedNumerals language pragma, IsNumeric typeclass and some methods to make that class useful with behavior similar to Lists and Strings.
Categories: Offsite Discussion

Beginner here: editor/IDE

Haskell on Reddit - Fri, 06/12/2015 - 6:07am


The Scala language led me to Haskell, so here I am trying to learn it.

As a C++/C#/Python/Scala programmer I'm used to having full-featured IDEs.

I tried EclipseFP and Leksah on Windows 7 64-bit but they're both unusable, unfortunately. EclipseFP is very slow: characters are displayed seconds after I type them. For this reason, I tried Leksah but it keeps crashing when I try to debug my code (when I press CTRL+ENTER to evaluate an expression).

So, what should I do? Should I try VIM? I've never used anything so Linux-ish.

submitted by Kiuhnm
[link] [105 comments]
Categories: Incoming News

Replacing cpp?

haskell-cafe - Fri, 06/12/2015 - 4:39am
I know the subject of cpp not working well with Haskell comes up every so often, usually with the conclusion that we need a preprocessor that understands Haskell code. If someone is working on that, this should probably be ignored. Maybe gpp could be used instead of having to write one from scratch? it allows you to define the syntax it uses for macros - both user and "meta". Possibly it's flexible enough to do what's needed? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Smarter way to write this little piece of code?

Haskell on Reddit - Fri, 06/12/2015 - 2:49am

Hello, I'm implementing a basic Knight's Tour path finder (Based on tuple list) and I think there should be a better way to write this, is there?:

knightJump s a b = if (plausibleJump s a b (-1) (2)) /= [] then plausibleJump s a b (-1) (2) else if (plausibleJump s a b (1) (2)) /= [] then plausibleJump s a b (1) (2) else if (plausibleJump s a b (2) (1)) /= [] then plausibleJump s a b (2) (1) else if (plausibleJump s a b (2) (-1)) /= [] then plausibleJump s a b (2) (-1) else if (plausibleJump s a b (1) (-2)) /= [] then plausibleJump s a b (1) (-2) else if (plausibleJump s a b (-1) (-2)) /= [] then plausibleJump s a b (-1) (-2) else if (plausibleJump s a b (-2) (-1)) /= [] then plausibleJump s a b (-2) (-1) else if (plausibleJump s a b (-2) (1)) /= [] then plausibleJump s a b (-2) (1) else []

PS: I'm sorry if this is some kind of eye-hurtin haskell gore. Newbie here

submitted by KomankK
[link] [11 comments]
Categories: Incoming News

Haskell on Reddit - Fri, 06/12/2015 - 12:05am
Categories: Incoming News

Question about constraining functions to particularADT constructors

haskell-cafe - Thu, 06/11/2015 - 5:54pm
Hello there, I've been thinking on different approaches to constraint particular functions to a particular constructor of an ADT in order to reduce representation of invalid states. Say for example I've this types: data Address = Address { ... } newtype Email = Email String data Package = Package { ... } data EmailMsg = EmailMsg { ... } data User = RealUser Address | VirtualUser Email And I would like to implement two functions: deliverPackage :: User -> Package -> IO Bool sendEmail :: User -> EmailMsg -> IO () I would like to constraint both deliverPackage and sendEmail to receive only the semantically correct constructor of User. I know of an approach I could use, that is wrapping each constructor in it's own newtype, and create some smart constructor that way, that approach works, but I find it rather verbose. Is there any other well known approach to deal with this scenarios? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at > http://mail.haskel
Categories: Offsite Discussion

7.10 branch

glasgow-user - Thu, 06/11/2015 - 5:21pm
Austin I'm getting these validation failures on the 7.10 branch. Are you? This is on Linux. Simon Unexpected failures: driver T8959a [bad stderr] (normal) ghci/scripts T9878b [bad stderr] (ghci) th T10279 [stderr mismatch] (normal) Unexpected stat failures: perf/should_run T4830 [stat not good enough] (normal) perf/should_run T7436 [stat not good enough] (normal) _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >
Categories: Offsite Discussion

US Haskell Developer Position

haskell-cafe - Thu, 06/11/2015 - 4:26pm
Karamaan Group, a principal investment firm based in Manhattan, is looking for an outstanding software developer to develop tools for financial analysis and knowledge management. We are a growth oriented firm that values people who take a craftsman's pride in their work. Our ideal candidate is an experienced software developer with strong analytical, organizational, and communication skills. A candidate who demonstrates an intense focus on quality, but has the ability to recognize and make the tradeoffs that are a necessary part of day-to-day software development. Candidates should have at least a degree in a quantitative field and a keen interest in building robust and elegant computer programs. This is a high-impact, high-visibility position where successful candidates will be entrusted with a lot of responsibility for products that have a direct effect on the P&L of the firm and influences our workflow. The ideal candidate will have experience with Haskell, relational database technologies, and Java. Al
Categories: Offsite Discussion

Please help. Unable to cabal install simple libraries, like vector, boxes on OS X.

Haskell on Reddit - Thu, 06/11/2015 - 1:54pm

Has anyone else faced this?

OS X Mavericks 10.9.5

ghci version -- 7.10.1

cabal --

bash-3.2$ cabal install vector

Resolving dependencies...

Configuring vector-

Building vector-

Preprocessing library vector-

Data/Vector/Generic.hs:61:3: parse error on input ‘unsafeUpd’ Failed to install vector-

submitted by sriramalka
[link] [7 comments]
Categories: Incoming News

Syntax readability survey

Haskell on Reddit - Thu, 06/11/2015 - 1:10pm

I've been wondering what makes code syntax in one programming language more readable / fun to write than others.

I wrote two ToDo apps in pseudo-code here:

Would love your thoughts on which one feels more readable and would be more enjoyable to read/write and why. Thanks!

submitted by everdev
[link] [7 comments]
Categories: Incoming News

Self-Representation in Girard’s System U

Lambda the Ultimate - Thu, 06/11/2015 - 12:45pm

Self-Representation in Girard’s System U, by Matt Brown and Jens Palsberg:

In 1991, Pfenning and Lee studied whether System F could support a typed self-interpreter. They concluded that typed self-representation for System F “seems to be impossible”, but were able to represent System F in Fω. Further, they found that the representation of Fω requires kind polymorphism, which is outside Fω. In 2009, Rendel, Ostermann and Hofer conjectured that the representation of kind-polymorphic terms would require another, higher form of polymorphism. Is this a case of infinite regress?

We show that it is not and present a typed self-representation for Girard’s System U, the first for a λ-calculus with decidable type checking. System U extends System Fω with kind polymorphic terms and types. We show that kind polymorphic types (i.e. types that depend on kinds) are sufficient to “tie the knot” – they enable representations of kind polymorphic terms without introducing another form of polymorphism. Our self-representation supports operations that iterate over a term, each of which can be applied to a representation of itself. We present three typed self-applicable operations: a self-interpreter that recovers a term from its representation, a predicate that tests the intensional structure of a term, and a typed continuation-passing-style (CPS) transformation – the first typed self-applicable CPS transformation. Our techniques could have applications from verifiably type-preserving metaprograms, to growable typed languages, to more efficient self-interpreters.

Typed self-representation has come up here on LtU in the past. I believe the best self-interpreter available prior to this work was a variant of Barry Jay's SF-calculus, covered in the paper Typed Self-Interpretation by Pattern Matching (and more fully developed in Structural Types for the Factorisation Calculus). These covered statically typed self-interpreters without resorting to undecidable type:type rules.

However, being combinator calculi, they're not very similar to most of our programming languages, and so self-interpretation was still an active problem. Enter Girard's System U, which features a more familiar type system with only kind * and kind-polymorphic types. However, System U is not strongly normalizing and is inconsistent as a logic. Whether self-interpretation can be achieved in a strongly normalizing language with decidable type checking is still an open problem.

Categories: Offsite Discussion