News aggregator

How to tell which MVar we are BlockedIndefinitelyOnMVar on?

Haskell on Reddit - Sun, 01/10/2016 - 8:10pm

Is there a way to get the MVar from a BlockedIndefinitelyOnMVar exception, or otherwise attach metadata to a MVar that is retrievable on BlockedIndefinitelyOnMVar?

submitted by fread2281
[link] [3 comments]
Categories: Incoming News

How many elements a list/sequence/vector can contain?

Haskell on Reddit - Sun, 01/10/2016 - 7:46pm

Hello,

Can anyone tell me the maximum number of elements that a list/sequence/vector can contain, and what is the maximum size in KBytes of a list/sequence/vector?

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

Eq1, Ord1, Show1: move from eq1, compare1, showsPrec1 to liftEq, liftCompare, liftShowsPrec

libraries list - Sun, 01/10/2016 - 3:08pm
In transformers-0.5:Data.Functor.Classes class methods like eq1 are replaced by liftEq. With transformers-0.4 I could define: data T a = complicated definition ... deriving (Eq, Ord, Show) instance Eq1 T where eq1 = (==) instance Ord1 T where compare1 = compare instance Show1 T where showsPrec1 = showsPrec In transformers-0.5 it seems that I have to implement Eq1, Ord1, Show1 instances manually. Is there some assistance to define eq1 and compare1 for an ADT? What are the use cases where eq1 was not powerful enough and liftEq is needed?
Categories: Offsite Discussion

pattern matching v. type checking

haskell-cafe - Sun, 01/10/2016 - 10:09am
I am, thanks to an idea from Elliot Cameron, using the Functional Graph Library (FGL) to implement [1] something resembling a hyperggraph, which I'm calling Mindmap, in which relationships can involve any number of things, including other relationships. (By contrast, in a graph, Edges cannot belong to other Edges; only Nodes can.) Here are the types: -- Exprs (expressions) play Roles in Rels (relationships). -- A k-ary (Arity k) Rel consists of a k-ary template and k members. -- Each k-ary Rel emits k+1 Edges toward the other Exprs: -- one connects it to its RelTplt (relationship template) -- k more connect it to each of its k RelMbrs (relationship members) -- The two paragraphs after it will clear up any questions about the next. type Mindmap = Gr Expr Role data Role = RelTplt | RelMbr RelPos deriving (Show,Read,Eq,Ord) data Expr = Str String | Tplt Arity [String] | Rel Arity -- TODO ? deduce the Arity of a Tplt from its [String] -- TODO ? deduc
Categories: Offsite Discussion

Help with pcre-heavy

Haskell on Reddit - Sun, 01/10/2016 - 9:38am

I have this code:

{-# LANGUAGE QuasiQuotes #-} import Text.Regex.PCRE.Heavy (gsub, re) ignore_comments :: String -> String ignore_comments text = gsub [re|\/\*[^\*]\*\/|] "" text main = do print $ ignore_comments "/*test commentary*/ other test"

He is cut simple commentary from string. But he doesn't work on test string(prints all string, without changes). I understand this is due to the initial slash in regexp. Maybe exist advanced option or escape rule for this? What's my mistake?

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

EndoApplicatives, anything similar?

Haskell on Reddit - Sun, 01/10/2016 - 9:34am

I've got this typeclass here (EDIT: It's a MonoApplicative, not an EndoApplicative):

class Functor f => MonoApplicative f where pureM :: a -> f a (<#>) :: f (a -> a) -> f a -> f a

It's exactly like Applicative, but restricting <*> to a single type. I tried to find something similar in the ecosystem, is there something out there?

submitted by AisRauli
[link] [31 comments]
Categories: Incoming News

Promotion of field accessors using DataKinds

haskell-cafe - Sun, 01/10/2016 - 1:23am
Hello all, Let's say I have some data data Config = Conf (len :: Nat) (turboEncabulate :: Bool) Using DataKinds, we can promote Config to a kind and Conf to a type. However, it does not appear that GHC supports e.g. data Thing (conf :: Config) = Thing data Count (n :: Nat) = Count foo :: Thing conf -> Count (len conf) foo Thing = Count That is, it does not appear to properly replace "len conf" with the value of len from conf. Instead, the way I've found to do this is to define class Lengthed (a :: Config) where type Len a :: Nat instance Lengthed (Conf n) where type Len (Conf n t) = n Now, foo :: Thing conf -> Count (Len conf) works fine. So manually defining a type function that intuitively does the exact same thing as "len" seems to work. Is there a particular reason behind this? Thanks, Will _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-
Categories: Offsite Discussion

Recent Spam

Haskell on Reddit - Sun, 01/10/2016 - 1:20am

Most of you have probably seen some intermittent spam, I just finished overhauling automod to hopefully curtail it more quickly than it has been. Please -- if you continue to see this spam -- report it and send me a modmail. Reporting it as 'spam' helps train the reddit spam filter, afaik, and modmailing us helps surface things we might miss.

All of reddit is currently getting pelted by some spam ring, hopefully it lets up soon.

EDIT: (because I forgot) -- part of this will automatically remove posts from users that are less than a few days old. If you are new, I understand this may be inconvenient, but it is necessary for the overall health of the community. If you have something you want to post and can't, wait a day. If you can't wait, send a modmail and we'll see what we can do.

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

suppress warning "Defined but not used: type variable ‘x’" in GHC-8.0

glasgow-user - Sun, 01/10/2016 - 12:57am
GHC-8.0 emits several new warnings of this kind: Defined but not used: type variable ‘x’ for declarations like type instance Snd x y = y Enthusiastically, I started to replace unused type function arguments by underscores, only to find out that older GHC versions do not accept that. With what option can I disable this warning? Or can it be removed from -Wall for now?_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Categories: Offsite Discussion

Adding writer transformer to list monad.

Haskell on Reddit - Sun, 01/10/2016 - 12:57am

Hello, As an exercise, I was trying to write a function that calculates all combinations of given list. So when I call the function like this

combinations [1,2,3]

It would return following value:

[[],[3],[2],[2,3],[1],[1,3],[1,2],[1,2,3]]

So, first I implemented a classic recursive version of the function. Than I implemented another one that is using list monads.

After I have 2 versions of the same function, I wanted to add writer monad to them to log function calls.

I was able to add writer monad to plain version, but I could not do the same thing for the one that uses list monad.

In short, I could not use writer monad transformer. Can somebody go over my function and tell me how to add writer monad transformer to that function?

Here is the all the functions I implemented:

http://nbviewer.ipython.org/gist/huseyinyilmaz/752a792bdc646af1eaba#Combinations-with-list-monad-and-writer-transformer

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

How to make industry quality software with Haskell?

Haskell on Reddit - Sun, 01/10/2016 - 12:51am

I have only used Haskell in academia where I just run my files using ghc and show my professors the output. Although, now I am looking to start a project with Haskell and I was wondering what are some tools I should be using when developing my project? In conjunction with that I am concerned about directory architecture and I am not sure what the best practice is for Haskell projects, perhaps there is a guide out there.

submitted by lilred181
[link] [34 comments]
Categories: Incoming News

Regarding Developing my skills with haskell!

haskell-cafe - Sat, 01/09/2016 - 8:50pm
Hello, I want to learn some practical application using haskell like some projects or developing a game. Can anyone suggest me some link to develop my skills with haskell ? Cheers, Abhijit _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

CfP: Workshop on Program Transformation for Programmability in Heterogeneous Architectures (Co-located with CGO16); Deadline Jan 15

General haskell list - Sat, 01/09/2016 - 2:02pm
[Apologies if you receive multiple copies of this announcement.] ********************************************************************************* PROHA 2016, CALL FOR PAPERS First Workshop on Program Transformation for Programmability in Heterogeneous Architectures http://goo.gl/RzGbzY Barcelona, 12th March 2016, in conjunction with the CGO'16 Conference ********************************************************************************* Important Dates: Paper submission deadline: 15 January 2016 23:59 (UTC) Author notification: 5 February 2016 Final manuscript due: 26 February 2016 Scope: Developing and maintaining high-performance applications and libraries for heterogeneous architectures is a difficult task, usually requiring code transformations performed by an expert. Tools assisting in and, if possible, automating such transformations are of course of great interest. However, such tools require significant knowledge and reasoning capabilities. For example, the former could be a machine-unders
Categories: Incoming News

New gtk2hs 0.12.4 release

gtk2hs - Wed, 11/21/2012 - 12:56pm

Thanks to John Lato and Duncan Coutts for the latest bugfix release! The latest packages should be buildable on GHC 7.6, and the cairo package should behave a bit nicer in ghci on Windows. Thanks to all!

~d

Categories: Incoming News