News aggregator

Instance match surprise

haskell-cafe - Mon, 02/01/2016 - 8:53pm
Dear List, Why does the first instance match? ANY is neither Eq nor Typeable. I thought I had some basic understanding of type classes, and now this... wojtek< at >biuro:~/src/he$ cat minimatch.hs {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} module MiniMatch where import Data.Typeable data A130 = A130 deriving (Eq) data ANY = ANY class AtmAcct a class Against q class (AtmAcct a, Against q) => Match a q where match :: a -> q -> Bool instance AtmAcct A130 instance Against ANY instance (Eq a, Eq q, Typeable a, Typeable q, AtmAcct a, Against q) => Match a q where match _ _ = False instance (AtmAcct a) => Match a ANY where match _ _ = True m1 = match A130 ANY -- offending line wojtek< at >biuro:~/src/he$ ghc minimatch.hs [1 of 1] Compiling MiniMatch ( minimatch.hs, minimatch.o ) minimatch.hs:21:6: error: • Overlapping instances for Match A130 ANY arising from a use of ‘match’ Matching instances: instance (Eq a, Eq q, Typeable a, Typeable q
Categories: Offsite Discussion

Hackage Docs

haskell-cafe - Mon, 02/01/2016 - 7:26pm
Hi friends! Apologize, a lot of Hackage docs issues discussed here already, but I'll decided to bring this question one more time. I'm facing missing docs during last few weeks, both Hoogle and Hayoo links to Hackage and usual response I see is "Not found". Stackage helps a lot, but most of the time I have to manually search same term on Stackage again. Can we improve this sad situation finally? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Neil Mitchell: New HLint version and API features

Planet Haskell - Mon, 02/01/2016 - 3:30pm

Summary: In the new version of HLint, errors are warnings and warnings are suggestions. I plan to remove the old API very soon.

I've just released a new version of HLint, the tool for suggesting hints to improve your Haskell code. This version comes with two big changes.

Firstly, hints have been reclassified in severity. What used to be errors are now warnings, and hints that used to be warnings are now suggestions. As people have mentioned in the past, nothing HLint suggested was really an error, and now HLint matches that.

Secondly, there is now an hlint API entry point in Language.Haskell.HLint3 which captures the pattern of running HLint with command-line arguments, but in process as a library. With that, I don't think there are any API patterns that are better captured by the Language.Haskell.HLint API. If no one contacts me with issues, I will be making the module Language.Haskell.HLint a copy of Language.Haskell.HLint3 in the next release.

This release (like all minor releases) fixes a few bugs and adds a few new features. As a few random examples, HLint now warns on a redundant DefaultSignatures language extension, suggests fmap in preference to liftM and warns when otherwise is used as a pattern variable. There is a complete change log in the repo.

Categories: Offsite Blogs

Question,re: failed attempt at constraining a Traversable instance.

haskell-cafe - Mon, 02/01/2016 - 3:28pm
Hi all, I’m trying to do this: data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) instance Functor Tree where fmap g Empty = Empty fmap g (Leaf x) = Leaf (g x) fmap g (Node t1 x t2) = Node (fmap g t1) (g x) (fmap g t2) instance Foldable Tree where foldMap f Empty = mempty foldMap f (Leaf x) = f x foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r instance (Monoid (f (Tree a))) => Traversable (Tree (f a)) where sequenceA Empty = pure Empty sequenceA (Leaf f) = Leaf <$> f sequenceA (Node t1 f t2) = (sequenceA t1) `mappend` (Leaf <$> f) `mappend` (sequenceA t2) And I’m being told this: The first argument of ‘Traversable’ should have kind ‘* -> *’, but ‘Tree (f a)’ has kind ‘*’ In the instance declaration for ‘Traversable (Tree (f a))’ And I don’t quite understand what I’m asking for that’s forbidden. Is it that I’m trying to declare that only a certain subset of Trees are Traversable, and that
Categories: Offsite Discussion

Share a variable across GHCI sessions: Possible?

haskell-cafe - Mon, 02/01/2016 - 9:10am
Suppose v is a view onto some data in a graph[1]. You ask GHCI to (show $ nodes v). You would like to ask GHCI in another window to (show $ disambiguations v), referring to the same v. Is it possible? My motivation is to show disambiguations that are about the nodes. Examples of disambiguations would be "a ! character adjacent to the left of a word means it requires money", or "CAP stands for Coastal Alliance of Pharoahs", or "a(/n)b means a needs b". [1] Using the Functional Graph Library, I am writing a graph database editor, Digraphs With Text: https://github.com/JeffreyBenjaminBrown/digraphs-with-text DWT is exceptionally flexible. Relationships can be of any arity, and can involve other relationships. For instance, in DWT the relationship "_ needs _ in order to _" has a natural representation; I am unaware of any other system in which it does. I would *love* help! And I take job offers seriously! -- Jeffrey Benjamin Brown _______________________________________________ Haskell-Cafe mailing list H
Categories: Offsite Discussion

How stable is the typerep fingerprint value?

haskell-cafe - Mon, 02/01/2016 - 1:13am
How stable is the typerep fingerprint value? Is it going to change between builds based on the same sources? Thanks, Anatoly _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

ANNOUNCE: call-haskell-from-anything 1.0

haskell-cafe - Sun, 01/31/2016 - 5:30am
Heya, I'm happy to announce a new release of call-haskell-from-anything [1], my library for FFI-via-serialisation that allows to easily call Haskell functions from any other language that can open shared object files (`.so` via `dlopen()`) and has a MessagePack library available. This is almost all programming languages; for examples for Python and Ruby see [2]. The FFI-via-serialisation approach makes it possible to export most functions to other languages "for free": no FFI type unpacking boilerplate, everything that has a MessagePack instance (much easier to write than `Storable` instances) will do. For example if you have a function chooseMax :: [Int] -> Int all you have do to make it callable is foreign export ccall chooseMax_export :: CString -> IO CString chooseMax_export = export chooseMax Version 1.0 uses closed type families to remove the restriction that so far, pure functions has to be wrapped into the Identity monad to be exported: a -> b -> ... -> Identity r With 1.0, this is
Categories: Offsite Discussion

Bug tracker for cpphs

libraries list - Sat, 01/30/2016 - 7:19am
Hi Malcolm, (I'm resending my old question to the libraries mailing list) Is there a bug tracker for cpphs? Best,
Categories: Offsite Discussion

Type introduction illustrated for casual haskellers

haskell-cafe - Sat, 01/30/2016 - 4:34am
Dear Haskellers, I'm enjoying Haskell. After FTP(Foldable/Traversable in Prelude proposal), newcomers encounter Foldable signatures in their early stage. So I drew a few simple illustrations about a type introduction for newcomers/casual haskellers. Type introduction illustrated for casual haskellers http://takenobu-hs.github.io/downloads/type_introduction_illustrated.pdf https://github.com/takenobu-hs/type-introduction-illustrated If I have misunderstood, please teach me. I'll correct them. Thank you =), Takenobu _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

[ANN] Aivika: Branching Discrete Event Simulation inHaskell

haskell-cafe - Fri, 01/29/2016 - 7:58pm
Hi Cafe, I’m glad to announce the release of three my simulation libraries [1, 2, 3]. I would like to tell more about the third library especially. The aivika-brances package [3] is new. It allows creating branches to run nested simulations within simulation so that the source simulation remains intact. It allows us to forecast the behavior looking into the future of the model. There is a similar method in the financial modeling, when estimating the option instrument. We build a tree of future possible changes to estimate the present value. The present depends on the future. My library allows building the same tree of nested simulations. At the same time, this is a general purpose discrete event simulation library with such things as random streams of orders (transacts), limited resources, queues, discontinuous processes, the global event queue, event-based activities and so on. I think that we can create very sophisticated simulation models with elements of prediction and forecasting. Probably, the li
Categories: Offsite Discussion

Haskell Weekly News

haskell-cafe - Fri, 01/29/2016 - 7:03pm
*Top Picks:* - Oskar Wickström rewrites the Oden-to-Go transpiler from Racket to Haskell <http://oden-lang.org/blog/compiler/2016/01/18/the-haskell-rewrite.html>. Oden is an FP language comprising an ML type system and LISP syntax. Oskar explains that he made the migration because of several advantages that Haskell offered over Racket: exhaustive pattern-match checking, type-guided refactoring, monad transformers, and faster execution times. Apropos, the convo over at lobste.rs <https://lobste.rs/s/8hidko/the_haskell_rewrite_the_motivation_for_moving_away_from_racket> links to this claim by Gabriel Gonzalez: "Haskell is an amazing language for writing your own compiler. If you are writing a compiler in another language you should genuinely consider switching." - Reviewing 2015 work month-by-month, Gracjan Polak tells the story of how he decided to lead the development of Haskell Mode <https://github.com/haskell/haskell-mode/wiki/Haskell-Mode-2015-retrospective
Categories: Offsite Discussion

Coordinated concurrent programming in Syndicate

Lambda the Ultimate - Fri, 01/29/2016 - 4:33pm

Coordinated concurrent programming in Syndicate
Tony Garnock-Jones and Matthias Felleisen.
2016 Most programs interact with the world: via graphical user interfaces, networks, etc. This form of interactivity entails concurrency, and concurrent program components must coordinate their computations. This paper presents Syndicate, a novel design for a coordinated, concurrent programming language. Each concurrent component in Syndicate is a functional actor that participates in scoped conversations. The medium of conversation arranges for message exchanges and coordinates access to common knowledge. As such, Syndicate occupies a novel point in this design space, halfway between actors and threads. If you want to understand the language, I would recommend looking at sections 1 to 2.2 (motivation and introducory examples) and then jumping at section 5, which presents fairly interesting designs for larger programs.

Concurrent program components must coordinate their computations to realize the overall goals of the program. This coordination takes two forms: the exchange of knowledge and the establishment of frame conditions. In addition, coordination must take into account that reactions to events may call for the creation of new concurrent components or that existing components may disappear due to exceptions or partial failures. In short, coordination poses a major problem to the proper design of effective communicating, concurrent components.

This paper presents Syndicate, a novel language for coordinated concurrent programming. A Syndicate program consists of functional actors that participate in precisely scoped conversations. So-called networks coordinate these conversations. When needed, they apply a functional actor to an event and its current state; in turn, they receive a new state plus descriptions of actions. These actions may represent messages for other participants in the conversations or assertions for a common space of knowledge.

Precise scoping implies a separation of distinct conversations, and hence existence of multiple networks. At the same time, an actor in one network may have to communicate with an actor in a different network. To accommodate such situations, Syndicate allows the embedding of one network into another as if the first were just an actor within the second. In other words, networks simultaneously scope and compose conversations. The resulting tree-structured shape of networked conversations corresponds both to tree-like arrangements of containers and processes in modern operating systems and to the nesting of layers in network protocols [1]. Syndicate thus unifies the programming techniques of distributed programming with those of coordinated concurrent programming.

By construction, Syndicate networks also manage resources. When a new actor appears in a conversation, a network allocates the necessary resources. When an actor fails, it deallocates the associated resources. In particular, it retracts all shared state associated with the actor, thereby making the failure visible to interested participants. Syndicate thus solves notorious problems of service discovery and resource management in the coordination of communicating components.

In sum, Syndicate occupies a novel point in the design space of coordinated concurrent (functional) components (sec. 2), sitting firmly between a thread- based world with sharing and local-state-only, message-passing actors. Our de- sign for Syndicate includes two additional contributions: an efficient protocol for incrementally maintaining the common knowledge base and a trie-based data structure for efficiently indexing into it (sec. 3). Finally, our paper presents eval- uations concerning the fundamental performance characteristics of Syndicate as well as its pragmatics (secs. 4 and 5).


Our examples illustrate the key properties of Syndicate and their unique combination. Firstly, the box and demand-matcher examples show that Syndicate conversations may involve many parties, generalizing the Actor model’s point-to-point conversations. At the same time, the file server example shows that Syndicate conversations are more precisely bounded than those of traditional Actors. Each of its networks crisply delimits its contained conversations, each of which may therefore use a task-appropriate language of discourse.

Secondly, all three examples demonstrate the shared-dataspace aspect of Syndicate. Assertions made by one actor can influence other actors, but cannot directly alter or remove assertions made by others. The box’s content is made visible through an assertion in the dataspace, and any actor that knows id can retrieve the assertion. The demand-matcher responds to changes in the dataspace that denote the existence of new conversations. The file server makes file contents available through assertions in the (outer) dataspace, in response to clients placing subscriptions in that dataspace.

Finally, Syndicate places an upper bound on the lifetimes of entries in the shared space. Items may be asserted and retracted by actors at will in response to incoming events, but when an actor crashes, all of its assertions are automatically retracted. If the box actor were to crash during a computation, the assertion describing its content would be visibly withdrawn, and peers could take some compensating action. The demand matcher can be enhanced to monitor supply as well as demand and to take corrective action if some worker instance exits unexpectedly. The combination of this temporal bound on assertions with Syndicate’s state change notifications gives good failure-signalling and fault-tolerance properties, improving on those seen in Erlang [7].


Syndicate draws directly on Network Calculus [2], which, in turn, has borrowed elements from Actor models [16,17,18], process calculi [19,20,21,22,23], and actor languages such as Erlang [7], Scala [24], E [25] and AmbientTalk [26].

This work makes a new connection to shared-dataspace coordination models [27], including languages such as Linda [28] and Concurrent ML (CML) [29]. Linda’s tuplespaces correspond to Syndicate’s dataspaces, but Linda is “generative,” meaning that its tuples take on independent existence once created. Syndicate’s assertions instead exist only as long as some actor continues to assert them, which provides a natural mechanism for managing resources and dealing with partial failures (sec. 2). Linda research on failure-handling focuses mostly on atomicity and transactions [30], though Rowstron introduces agent wills [31] and uses them to build a fault-tolerance mechanism. Turning to multiple tuplespaces, the Linda variants Klaim [32] and Lime [33] offer multiple spaces and different forms of mobility. Papadopoulos [34] surveys the many other variations; Syndicate’s non-mobile, hierarchical, nameless actors and networks occupy a hitherto unexplored point in this design space.

Some of the proposed designs were surprising to me. There is a reversal of perspective, from the usual application-centric view of applications being first, with lower-level services hidden under abstraction layers, to a more medium-directed perspective that puts the common communication layer first -- in the example of the TCP/IP stack, this is the OS kernel.
Categories: Offsite Discussion

setup-Simple-Cabal-1.22.5.0-x86_64-windows-ghc-7.10.3.exe: : does not exist

haskell-cafe - Fri, 01/29/2016 - 1:45am
L.S., Why do I get the message: setup-Simple-Cabal-1.22.5.0-x86_64-windows-ghc-7.10.3.exe: : does not exist after command "cabal install", and what can I do about it ? Regards, Henk-Jan van Tuyl
Categories: Offsite Discussion

A Sliding TChan?

haskell-cafe - Thu, 01/28/2016 - 10:30pm
We're currently using a TMChan to broadcast from a single producer thread to many consumer threads. This works well! However, we're seeing issues with a fast producer and/or a slow consumer, with the channel growing unbounded. Fortunately, our producer-consumer communication is time-sensitive and tolerant of loss: we're ok with the producer always writing at the expense of dropping communication to a slow consumer. A TMBChan provides a bounded channel (but no means to dupe/broadcast) where a writer will block once the channel fills up. In our use case, we'd like to continue writing to the channel but dropping off the end of the channel. Clojure's core-async module has some related concepts, in particular the notion of a sliding buffer <https://clojure.github.io/core.async/#clojure.core.async/sliding-buffer> that drops the oldest elements once full. Has anyone encountered something similar in working with channels and/or have any solutions? Thanks! Mark _______________________________________________ Haskel
Categories: Offsite Discussion

Hide the data constructor for type family instance

haskell-cafe - Thu, 01/28/2016 - 8:01pm
Hi Cafe, When instantiating a type class with type family, I see that haddock shows the data constructor for the type family as visible. This is what I would like to avoid. I would like to hide the details of the data constructor in the documentation. An example is stated below:
Categories: Offsite Discussion

FICS client in Haskell

haskell-cafe - Thu, 01/28/2016 - 6:37pm
Hi, I've been working on a FICS (Free Internet Chess Server) Client for a bit over a year now and it is finally in a presentable state. It would be great if you would like to have a look at the source code and let me know what you think! When I started with this project I was just starting to learn Haskell and I would like to know if the code is accessible/readable/idiomatic, if the overall organization seems reasonable as well or if you might have any other suggestion about what I could improve. (ie: I haven't decided on what logging framework to use.) The code is on github: https://github.com/tgass/macbeth I thank you all very much in advance! Tilmann https://github.com/tgass/macbeth/blob/master/src/Macbeth/Fics/FicsConnection.hs Opens a telnet connection to freechess.org. Using conduit and attoparsec messages from the server are parsed to FicsMessages and put into a Chan. https://github.com/tgass/macbeth/blob/master/src/Macbeth/Fics/FicsMessage.hs The domain model The UI is using wx widget
Categories: Offsite Discussion

How does -N allot cores?

haskell-cafe - Thu, 01/28/2016 - 5:05am
Hi Cafe, On an 1P system, there are 8 cores. Does -N8 send one thread to each core no matter how loaded each core is? Assuming 6 cores are busy, will -N8 send threads only to the two idle cores? If -N8 sends threads to eight cores no matter what, is there any function that detects number of idle (or usage less than certain percentage) cores? Suppose a 4P system has 32 cores (4 processors with each processor having 8 cores). Assuming the whole system is idle, how will -N32 work? Thanks, Hong _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Joachim Breitner: Dreaming of role playing

Planet Haskell - Thu, 01/28/2016 - 1:26am

Recently, at a summer-school-like event, we were discussing pen-and-paper role playing. I’m not sure if this was after a session of role-playing, but I was making the point that you don’t need much or any at all of the rules, and scores, and dice, if you are one of the story-telling role players, and it can actually be more fun this way.

As an example, I said, it can make sense if one of the players (and the game master, I suppose) reads up a lot about one aspect of the fantasy world, e.g. one geographical area, one cult, one person, and then this knowledge is used to create an exciting puzzle, even without any opponents.

I’m not quite sure, but I think I fell asleep shortly after, and I dreamed of such a role playing session. It was going roughly like this:

I (a human), and my fellows (at least a dwarf, not sure about the rest) went to some castle. It was empty, but scary. We crossed its hall, and went into a room on the other side. It was locked towards the hall by a door that covered the door frame only partly, and suddenly we could see a large Ogre, together with other foul folk not worth mentioning, hammered at the door. My group (which was a bit larger in that moment) all prepared shooting arrows at him the moment it burst through the door. I had the time to appreciate the ingenuity that we all waited for him to burst through, so that none of the arrows would bounce of the door, but it did not help, and we ran from the castle, over a field, through a forest, at the other side of which we could see, below a sleep slope, a house, so we went there.

The path towards that was filled with tracks that looked surprisingly like car tracks. When we reached the spot there was no house any more, but rather a cold camp side. We saw digging tools, and helmets (strangely, baseball helmets) were arranged in a circle, as if it was a burial site.

We set up camp there and slept.

It occurred to me that I must have been the rightful owner of the castle, and it was taken by me from my brother and his wife, who denied my existence or something treacherously like that. When we woke up at the camp side, she were there, together with what must be my niece. My sister in law mocked us for fighting unsuccessfully at the castle, but my niece was surprised to see me, as I must have a very similar appearance to my brother. She said that her mother forbid it, but she nevertheless sneakily takes out something which looks like a Gameboy with a camera attachment and a CompactFlash card from her mothers purse, puts it in and take a photo of me. This is when I realize that I will get my castle back.

At that moment, I woke up. I somewhat liked the story (and it was a bit more coherent in my mind than what I then wrote down here), so I wanted to write it down. I quickly fetched my laptop. My friends at the summer school were a bit worried, and I promised not to mention their names and concrete places, and started writing. They distracted me, so I searched for a place of my own, lied down (why? no idea), and continued writing. I had to to touch writing on my belly, because my laptop was not actually there.

I also noticed that I am back at the camp side, and that I am still wearing my back protector that I must have been wearing while fighting in the castle, and which I did not take off while sleeping at the camp side. Funnily, it was not a proper medieval amour, but rather my snowboarding back protector.

At that moment, I woke up. I somewhat liked the story (and it was a bit more coherent in my mind than what I then wrote down here), so I wanted to write it down. I quickly got up, started my laptop, and wrote it down. And this is what you are reading right now.

Off to bed again, let’s see what happens next.

Categories: Offsite Blogs

Hackage hoq?

haskell-cafe - Wed, 01/27/2016 - 7:00pm
Hello, I successfully built hoq. When I run th hoq executable, I get ">" prompts but am not sure what to do. I read some of the code and I tried putting .hoq on the command line, That didn't work. Has anyone tried hoq?? Vasily
Categories: Offsite Discussion

ETAPS 2017 call for satellite events

General haskell list - Wed, 01/27/2016 - 1:56pm
20th European Joint Conferences on Theory and Practice of Software ETAPS 2017 Uppsala, Sweden, 23-29 April 2017 http://www.etaps.org/2017/ Call for Satellite Events
Categories: Incoming News