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 heresubmitted by KomankK
[link] [11 comments]
Has anyone else faced this?
OS X Mavericks 10.9.5
ghci version -- 7.10.1
cabal -- 220.127.116.11
bash-3.2$ cabal install vector
Preprocessing library vector-0.10.12.3...
Data/Vector/Generic.hs:61:3: parse error on input ‘unsafeUpd’ Failed to install vector-0.10.12.3submitted by sriramalka
[link] [7 comments]
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: https://gist.github.com/everdev/275c8562e356b7f30c52
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]
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.
Linky to Facebook blog: Open-sourcing Facebook Infer: Identify bugs before you ship
I mean when all its parameters are the same type.
So if you have this:createUser :: String -> String -> String -> User createUser firstName lastName aboutMe = fail
What are the best modern techniques for ensuring I don't pass the arguments in the wrong order?
P.S. I'm aware that functions technically only have one argument, but I hope you know what I mean.submitted by [deleted]
[link] [25 comments]
I guess I mean both a build tool and a framework. Something that be be bootstrapped pretty quickly.
Ideally all configuration would have sane, modern defaults, and I wouldn't touch any configuration files until I absolutely need to override something. Probably the only thing I'll ever configure is my database.
I'm a fan of rapid development, TDD, and BDD. I only want to worry about the business logic of my app, how I structure my model, and how I render things to the browser (oh, I guess that's MVC, isn't it?).
Everything else should be automatic and something I don't have to think about. I'm okay with "opinionated" tools if they allow for rapid development.
Are there any modern Haskell frameworks and build tools to let me do this?submitted by almost_haskeller
[link] [9 comments]