News aggregator

Function Currying Question

Haskell on Reddit - Sun, 04/12/2015 - 11:16pm

Is it always true that func a = func2 a can be reduced to func = func2 Or bar a b = foo a b can be reduced to bar = foo?

And this is because of the way functions are curried?

EDIT: some typos

submitted by tmtwd
[link] [12 comments]
Categories: Incoming News

Question From Learn You A Haskell For Good (Kinds and types)

Haskell on Reddit - Sun, 04/12/2015 - 9:26pm

data Frank a b = Frank {frankField :: b a} deriving (Show)
The writer says this has a kind of: * -> (* -> *) - > *

The first represents the a, the (* -> *) represents the b. So what does the last * represent?

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

Compilation time with cabal under Windows

Haskell on Reddit - Sun, 04/12/2015 - 5:30pm

I've been wondering: how fast "should" ghc/cabal work?

I'm installing lens-4.9 with cabal and GHC 7.8.3 in a fresh sandbox right now and the process has been running for about 3.5 hours, at 100% CPU usage (quad-core i7). Granted, lens installs transformers and friends, but is it really supposed to take this long, or is something wrong with my setup? Deleting the .cabal-folder/reinstalling the Haskell platform hasn't helped.

Has anyone else had this problem? Is compilation perhaps faster under Linux?

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

beginner Q: how do you tell how well-maintained a library is?

Haskell on Reddit - Sun, 04/12/2015 - 4:33pm

As a beginner, there's a huge number of packages to wade through and it's often difficult to tell what's well-maintained vs. what's abandoned. How do you go about figuring out which packages are being actively used and developed vs. abandoned?

submitted by klaxion
[link] [24 comments]
Categories: Incoming News

Haskell IDE on Windows (source editing; project preparation and compiling/building)

Haskell on Reddit - Sun, 04/12/2015 - 12:39pm

I'm learning C++ at college ATM and using Visual Studio. Needless to say, it's a breeze; I only ever have to worry about the code and the dependencies between files. Everything else just works.

So I've become quite interested, very recently, in Haskell. In FP in general. Started out with messing with F# a bit and it intrigued me. Read around, went ahead and installed the Haskell Platform, and now I'm supremely stuck.

I can load/run separate .hs files through GHCi/runhaskell but otherwise, nothing works. Tried setting up several plugins, the last being several IntelliJ ones, but I can't for the life of me figure out how project handling works. Some sources speak of GHC and Cabal different build environments, of manually written make files and stuff like that...

I've yet to find a tutorial speaking a language I can understand. Using cabal init fails on the 3rd step with "Error: cabal: git: no source" or something like that.

Thanks a lot.

submitted by Enamex
[link] [44 comments]
Categories: Incoming News

Why there isn't a Pure typeclass ?

Haskell on Reddit - Sun, 04/12/2015 - 11:50am

An Applicative is a Functor with 2 functions, one to create an instance from a value (pure) and one to zip them (through <*>). However, I'm sure they are functors for which pure makes sense, but <*> doesn't. As now Applicative is a superclass of Monad, it would have make sense to also introduce a Pure class just defining pure?.

submitted by maxigit
[link] [78 comments]
Categories: Incoming News

[Announcement] FLTKHS - Bindings to the FLTK GUI Toolkit

Haskell on Reddit - Sun, 04/12/2015 - 9:49am

I'm pleased to announce the first release of Haskell bindings to the FLTK GUI toolkit.

It now works smoothly on Windows (64-bit), Linux and Mac allowing you to create truly cross-platform native GUI applications in pure Haskell and deploy statically linked executables with no dependencies.

Most of the FLTK API is covered except for a few minor widgets which I plan to get to in the next release.

Motivation behind the package and installation instructions are found in the Haddocks. And to get you started it ships with a number of demos.

If you have any issues please report them on the Github page.

I'd also love any other feedback so feel free to comment here or email me at the address listed on the Hackage page.

Hope you enjoy!

submitted by deech
[link] [9 comments]
Categories: Incoming News

Dealing with GHC 7.10 prelude imports

haskell-cafe - Sun, 04/12/2015 - 8:55am
Hi, I've run into a couple of cases when attempting to support multiple GHC versions in my libraries (7.6.3 -> 7.10) where I've repeatedly made mistakes due to being warned about unused imports for various modules that are now part of the Prelude such as Data.Monoid, Data.Foldable, etc. which I subsequently remove either manually or via editor automation sufficiently indistinguishable from magic. This then results in successful compilation on 7.10 and failure on earlier versions of GHC due to missing imports (ie. Data.Monoid (mappend, mempty)), which prior to my current workflow of manually building on multiple versions of GHC before releasing a new version, manifested once or twice only after uploading to Hackage. Now this is all user/workflow error on my part, but I wondered if others have some kind of trick up their sleeve for avoiding these kind of issues? I could attempt to tailor the compiler's warning flags appropriately, but it bodes ill for spotting genuinely unused imports. Cheers, Brendan ____
Categories: Offsite Discussion

Is there any way to compile this church number division combinator?

Haskell on Reddit - Sat, 04/11/2015 - 8:24pm

Mind the following program:

-- Conversion between int and church numerals intToChurch n f a = if n == 0 then a else f (intToChurch (n - 1) f a) churchToInt n = n (+ 1) 0 -- Church number division -- div = (\ v0 -> (\ v1 -> (\ v2 -> (\ v3 -> ((v1 (\ v4 -> (v4 v3))) ((v0 (((v1 (\ v4 -> (\ v5 -> (\ v6 -> (v4 (\ v7 -> ((v5 v7) v6))))))) (\ v4 -> v4)) (\ v4 -> (\ v5 -> (v5 (v2 v4)))))) (((v1 (\ v4 -> (\ v5 -> v4))) (\ v4 -> v4)) (\ v4 -> v4)))))))) -- Church number addition add = (\ v0 -> (\ v1 -> ((v1 (\ v2 -> (\ v3 -> (\ v4 -> (v3 ((v2 v3) v4)))))) v0))) main = do print (churchToInt (add (intToChurch 2) (intToChurch 3))) -- outputs 5 -- print (churchToInt (div (intToChurch 9) (intToChurch 3))) -- should output 3 ?

This should be self-descriptive: I have functions to convert between church numbers and ints and two functions which operate on church numbers, div and add. The add function compiles without issues, but the div function doesn't! I know, of course, it falls in the class of terms rejected by the type system. But, on this case, this is a perfectly valid function (which works, for example, on both JavaScript and Scheme without any issue) and I would like to use this function on Haskell. Is it possible to ask GHC to allow it?

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


glasgow-user - Sat, 04/11/2015 - 5:44pm
What’s the story with this? I tried to follow the instructions here: <> but I get Dominic Steinitz dominic< at > _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >
Categories: Offsite Discussion

Proposal for a generic showIntAtBase

libraries list - Sun, 04/05/2015 - 5:46pm
Hi, The current implementation of showIntAtBase in Numeric is limited to Chars currently. *showIntAtBase* * :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS* The 2 reasons for this constraint is: a) We only accept functions of the form (Int -> Char) b) An implicit concatenation using (:) I'd like to propose a new function showIntAtBaseGeneric that removes the (Int -> Char) function constraint and takes an additional function to replace the implicit (:) operator. *showIntAtBaseGeneric* * :: (Integral a1, Num b, Show a1) =>* * a1 -> (b -> a) -> (a -> s -> s) -> a1 -> s -> s* Now showIntAtBase may be implemented as: *showIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS* *showIntAtBase base toChr n0 r0 = showIntAtBaseGeneric base toChr (:) n0 r0* The API and behavior of showIntAtBase remains unchanged while allowing for generic conversions not limited to Chars alone. *Example: * *λ> showIntAtBaseGeneric 26 id (:) 500 [] -- convert 500 to base26 and provid
Categories: Offsite Discussion

A Random Strawman

libraries list - Sat, 04/04/2015 - 6:57pm
Hello All, Having skimmed the literature, run some tests and benchmarks: The current System.Random is broken: Furthermore, this is recorded in at least two published papers: and The tf-random package does not have this breakage and is based on good theoretical foundations. In my tests tf-random performs better than System.Random. As a result of which, I am very much inclined to suggest we replace the code in System.Random with tf-random. Before doing any more work on this, I’d like to understand what the next steps should be. How much review should be carried out? I have no reason to doubt the implementors have done a great job but should someone (who?) review the code more formally. If so what would the process / tools be? Tests in packages / applications may now fail as the (pseudo) random numbers will be different w
Categories: Offsite Discussion

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!


Categories: Incoming News