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]
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]
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]
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]
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.
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 welcomesubmitted by haskellthrowaway
[link] [5 comments]
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]
- Are you a Big Data Engineer who wants to work on innovative cloud and real-time data analytic technologies?
- Do you have a passion for turning data into meaningful information?
- Does working on a world-class big data project excite you?
Our client is currently looking in growth phase and looking for passionate and creative Data Scientists who can design, development, and implement robust, and scalable big data solutions. This is a role where you will need to enjoy being on the cusp of emerging technologies, and have a genuine interest in breaking new ground.
Your skills and experience will cover the majority of the following:
- Experience working across real-time data analytics, machine learning, and big data solutions
- Experience working with large data sets and cloud clusters
- Experience with various NoSQL technologies and Big Data platforms including; Hadoop, Cassandra, HBASE, Accumulo, and MapReduce
- Experience with various functional programming languages including; Scala, R, Clojure, Erlang, F#, Caml, Haskell, Common Lisp, or Scheme
This is an excellent opportunity for someone who is interested in a change in lifestyle, and where you would be joining other similar experienced professionals!
New Zealand awaits!
Get information on how to apply for this position.