News aggregator

Request: Pre-built VM image with GHCJS setup

Haskell on Reddit - Mon, 08/11/2014 - 7:33pm

So, as many of you know, GHCJS is pretty hard to get set up.

Clearly, some people have gotten GHCJS set up, and some will be in a VM image.

So, I'm requesting that someone share that image.

I've tried the Vagrant images, but they haven't worked for me, even the pre-built ones. They don't seem to have been updated for quite some time, and I get errors running vagrant up with them.

GHCJS would be great if it were easy, but in the meantime, I think having a good starter VM floating around would be a good solution.

That said, if someone has a good guide of how to get the vagrant images up and working, that would be great. But would much prefer a VM image I can just download and run.

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

New Functional Programming Job Opportunities

haskell-cafe - Mon, 08/11/2014 - 5:00pm
Here are some functional programming job opportunities that were posted recently: Big Data Engineer / Data Scientist at Recruit IT http://functionaljobs.com/jobs/8731-big-data-engineer-data-scientist-at-recruit-it Cheers, Sean Murphy FunctionalJobs.com
Categories: Offsite Discussion

Snap projects to learn from

Haskell on Reddit - Mon, 08/11/2014 - 4:05pm

Can you recommend reliable open-source Snap projects?

I have some knowledge of Haskell (mostly gained from Learn You a Haskell), and I have experience creating web apps with Django.

The idea is to see good examples of web development using Haskell that we can learn from. (The focus of my interest would be project structuring, testing and session handling.)

submitted by danbal
[link] [6 comments]
Categories: Incoming News

Dan Burton: Similarities: Monoid, MonadPlus, Category

Planet Haskell - Mon, 08/11/2014 - 3:41pm
This is perhaps obvious to anyone who has thoroughly studied category theory, but the similarities between Monoid, MonadPlus, and Category, have really struck me lately. I’m going to take a smidgeon of artistic license to present this train of thought. … Continue reading →
Categories: Offsite Blogs

How to write reverse of this function?

Haskell on Reddit - Mon, 08/11/2014 - 12:01pm

I made a function in Haskell that takes in a number and returns a list of integers from 1 to that number.

gen x = [1..x] gen 4 -> [1, 2, 3, 4]

As I was learning about the monads I noticed that I could bind a list into this function as it has the type of (a -> m a).

[2, 3, 6, 1, 4] >>= gen -> [1, 2, 1, 2, 3, 1, 2, 3, 4, 5, 6, 1, 1, 2, 3, 4]

Then I wanted to write a function that would reverse the (>>= gen) and i came up with this function.

revgen (x:xs) = case (null xs) of False -> case ((head xs) - x) of 1 -> 1 + revgen xs otherwise -> 0 : revgen xs True -> 1 : []

But it doesn't work, I think because of the revgen returning both numbers and lists. But I can't come up with a way to do this any other way with one function. Also the nested cases look ugly as hell but I quess they work as intented because at least it compiles.

submitted by SpacemanInBikini
[link] [10 comments]
Categories: Incoming News

Updating code to work with vinyl 0.4

haskell-cafe - Mon, 08/11/2014 - 10:43am
Hi, I'm looking for some help in helping to migrate to vinyl-0.4 from earlier version. I'll first outline how I currently have things set up and then ask a few questions. For reference the whole project is at [1]. You can just skip to questions in the end if you want to. I have a small project which goes out to a few sites, fetches some similar XML data, parses some fields and returns a data type. My original attempt was to generate a data type per site but that was very ugly: couldn't reuse functions, accessors, anything. So I then turned to vinyl and have the following solution: I have a bunch of common fields defined like this: -- file_url ∷ "file_url" ::: String file_url = Field parent_id ∷ "parent_id" ::: Maybe Integer parent_id = Field -- and so on. I'm using HXT to process the XML I get from each site so I have created many HXT arrows creating each field like this: -- parent_idA ∷ (Functor (cat XmlTree), ArrowXml cat) ⇒ cat XmlTree (PlainRec '["parent_id" ::: Maybe Integer]
Categories: Offsite Discussion

OTAS Quant 1: Position Keeping

Haskell on Reddit - Mon, 08/11/2014 - 10:09am
Categories: Incoming News

Additive/Multiplicative Inverse of Algebraic Types?

Haskell on Reddit - Mon, 08/11/2014 - 9:35am

I apologize if this is way off topic, but I've been poring over this for a while and I think this might be a good place to ask: has there been any research on 'inverse types'? Either in Haskell or in general.

I'm trying to learn more about abstract algebra and algebraic data types, and from what I can tell the types form a semiring (though if there's a more accurate/complete structure please let me know!). What I'm wondering is if it's possible to extend this semiring to a full ring, or even a field. I've heard of a Grothendieck construction for groups and suspect it is also applicable to semirings, but I haven't really investigated that area very much.

Additionally I can't seem to find any intuitive expression of the additive or multiplicative inverse of a type offhand, but I'm curious if there even is one. Additive inverses seem to make a little bit of sense perhaps in a resource consumption sort of way, but it's shaky at best. And I have no idea what the reciprocal of a type would represent either, though I did see a 'quotient type' mentioned at the end of the clowns and jokers paper.

submitted by asampson
[link] [30 comments]
Categories: Incoming News

Easy Haskell Profiling

Haskell on Reddit - Mon, 08/11/2014 - 9:19am
Categories: Incoming News

WLP/WFLP - Call for Participation - September 15-17

General haskell list - Mon, 08/11/2014 - 9:17am
Call for Participation 28th Workshop on (Constraint) Logic Programming (WLP 2014) co-located with 23rd International Workshop on Functional and (Constraint) Logic Programming (WFLP 2014) Lutherstadt Wittenberg, Germany, September 15 - 17 Early registration deadline: August 26 The international workshops on functional and logic programming aim at bringing together researchers interested in functional programming, logic programming, as well as their integration. The workshops on (constraint) logic programming serve as the scientific forum of the annual meeting of the Society of Logic Programming (GLP e.V.) and bring together researchers interested in logic programming, constraint programming, and related areas like databases, artificial intelligence, and operations research. Invited Speakers: Michael Hanus: Declarative Multi-paradigm Programming (Tutorial). Sven Thiele: Answer Set Programming for Systems Biology. Accepted Papers and Preliminary Program: http://dbs.informatik.uni-halle.de/wlp14/prog
Categories: Incoming News

Type families on unboxed types

Haskell on Reddit - Mon, 08/11/2014 - 4:24am

I have:

type family Flip a where Flip (a -> b) = b -> a > :kind! Flip (Int -> Bool) Flip (Int -> Bool) :: * = Bool -> Int

but it doesn't work for unboxed values:

> Flip (Int# -> Bool) Flip (Int# -> Bool) :: * = Flip (Int# -> Bool) > import Data.Type.Equality > :t Refl :: (Flip (Int# -> Bool) :~: (Bool -> Int#)) <interactive>:1:1: Warning: Couldn't match type ‘Flip (Int# -> Bool)’ with ‘Bool -> Int#’ Expected type: Flip (Int# -> Bool) :~: (Bool -> Int#) Actual type: (Bool -> Int#) :~: (Bool -> Int#) In the expression: Refl :: Flip (Int# -> Bool) :~: (Bool -> Int#) Refl :: (Flip (Int# -> Bool) :~: (Bool -> Int#)) :: (Bool -> Int#) :~: (Bool -> Int#)

Is there any way to fix that?

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

Safely Composable Type-Specific Languages

Lambda the Ultimate - Mon, 08/11/2014 - 12:27am

Cyrus Omar, Darya Kurilova, Ligia Nistor, Benjamin Chung, Alex Potanin, and Jonathan Aldrich, "Safely Composable Type-Specific Languages", ECOOP14.

Programming languages often include specialized syntax for common datatypes (e.g. lists) and some also build in support for specific specialized datatypes (e.g. regular expressions), but user-defined types must use general-purpose syntax. Frustration with this causes developers to use strings, rather than structured data, with alarming frequency, leading to correctness, performance, security, and usability issues. Allowing library providers to modularly extend a language with new syntax could help address these issues. Unfortunately, prior mechanisms either limit expressiveness or are not safely composable: individually unambiguous extensions can still cause ambiguities when used together. We introduce type-specific languages (TSLs): logic associated with a type that determines how the bodies of generic literals, able to contain arbitrary syntax, are parsed and elaborated, hygienically. The TSL for a type is invoked only when a literal appears where a term of that type is expected, guaranteeing non-interference. We give evidence supporting the applicability of this approach and formally specify it with a bidirectionally typed elaboration semantics for the Wyvern programming language.

Categories: Offsite Discussion

Type class with unbox :: Prim -> Prim# method

Haskell on Reddit - Sun, 08/10/2014 - 9:31pm

Is there any way to make a type class that looks something like:

class Unbox ty where type Unboxed ty :: # unbox :: ty -> Unboxed ty instance Unbox Int where type Unboxed Int = Int# unbox (I# i) = i

Fails with an unsurprising error. Making the kind of Unboxed ty * I used the fact that Int -> Int# :: * but that compiles:

class Unbox ty where type Unboxed ty unbox :: Unboxed ty instance Unboxed Int where type Unboxed Int = Int -> Int# unbox (I# i) = i instance Unboxed Float where type Unboxed Float = Float -> Float# unbox (F# f) = f

But isn't actually usable:

> :t unbox ... :: Unbox a => Unboxed a > :t unbox (5 :: Int) ... :: (Unbox a, Unboxed a ~ (Int -> t)) => t > :t unbox (5 :: Int) :: Int# <interactive>:1:1: Warning: No instance for (Unbox a0) arising from a use of ‘unbox’ The type variables ‘k0’, ‘a0’ are ambiguous Note: there is a potential instance available: instance [overlap ok] Unbox Int -- Defined at /tmp/tmp.4JSrL7ihDP.hs:211:10 In the expression: unbox (5 :: Int) :: Int# <interactive>:1:1: Warning: Couldn't match expected type ‘Int -> Int#’ with actual type ‘Unboxed a0’ The type variables ‘k0’, ‘a0’ are ambiguous The function ‘unbox’ is applied to one argument, but its type ‘Unboxed a0’ has none In the expression: unbox (5 :: Int) :: Int#

Comments welcome

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

(Nearly) first-class unboxed values: Retrospect

Haskell on Reddit - Sun, 08/10/2014 - 9:20pm

Appearing in the paper Unboxed value as first class citizens in a non-strict functional language, GHC allows allowing user defined data types to contain unboxed values.

This seems to have worked great in Haskell and allows adding optimizations like -ffast-math as a library. THe paper appeared in 1991, have any other languages adopted this view of unboxed values? If not, is it because it only benefits non-strict languages? Something else?

submitted by haskellthrowaway
[link] [2 comments]
Categories: Incoming News