Re: [Haskell-cafe] indentation with let and do
The first version has bar True and False all at the same indentation level. As such they are seen as standalone expressions, rather than being nested under the one introduced by bar. See http://en.wikibooks.org/wiki/Haskell/Indentation On Thu, Oct 3, 2013 at 8:31 PM, Corentin Dupont corentin.dup...@gmail.comwrote: Hi the list, why do this function doesn't compile (parse error): test :: Bool - IO () test foo = do let bar = case foo of True - Foo; False - Bar return () while this one does (just adding one space in front of True and False): test :: Bool - IO () test foo = do let bar = case foo of True - Foo; False - Bar return () Thanks!! Corentin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source
Thanks for the reference, but GHC already invokes the CPP. I think I am going to have to invoke a load of the module with ghc flags set to keep the output of the CPP phase, and then re-invoke it on that output to get the tokens. My question is more whether this CPP output can be kept in the GHC session for re-use, or whether I will have to mess around on the file system. Alan On Wed, Sep 11, 2013 at 12:56 AM, Henk-Jan van Tuyl hjgt...@chello.nlwrote: On Wed, 11 Sep 2013 00:54:07 +0200, Henk-Jan van Tuyl hjgt...@chello.nl wrote: Another option could be the cpphs package; the documentation has disappeared from haskell.org, but can be found in the Web Archive[0]. I just found the latest documentation at http://code.haskell.org/cpphs/**docs/http://code.haskell.org/cpphs/docs/ Regards, Henk-Jan van Tuyl -- Folding@home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/**hjgtuyl/tourdemonad.htmlhttp://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Proposal: New syntax for Haskell
I think the normal motivation for cucumber syntax is that it is a way to communicate requirements with non-technical people. On Tue, Sep 10, 2013 at 11:48 AM, John Wiegley jo...@fpcomplete.com wrote: Niklas Hambüchen m...@nh2.me writes: Code written in cucumber syntax is concise and easy to read concise |kənˈsīs|, adj. giving a lot of information clearly and in a few words; brief but comprehensive. Compare: Scenario: Defining the function foldl Given I want do define foldl Which has the type (in brackets) a to b to a (end of brackets), to a, to list of b, to a And my arguments are called f, acc, and l When l is empty Then the result better be acc Otherwise l is x cons xs Then the result should be foldl f (in brackets) f acc x (end of brackets) xs To: foldl :: (a - b - a) - a - [b] - a foldl f z [] = z foldl f z (x:xs) = foldl f (f z x) xs How is that more concise or preferable? -- John Wiegley FP Complete Haskell tools, training and consulting http://fpcomplete.com johnw on #haskell/irc.freenode.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC API question: Getting access to cpp processed source
Hi Cafe I have just discovered that GHC.getTokenStream fails if it is used on a module with CPP directives in it. This is reported in http://ghc.haskell.org/trac/ghc/ticket/8265 Is there an easy way to get access to the pre-processed source, without having to explicitly write it to an output file in a temporary location? In other words an equivalent to getModuleSourceAndFlags that does the right thing. This currently prevents HaRe from processing files with preprocessor directives in them, I would like to come up with a workaround for current GHC versions, rather than having to wait for a future one. Regards Alan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc-mod v3.0.0
Is this backward compatible with older versions of Cabal? I am considering whether to migrate HaRe to use this, I would prefer not to have it then fail to work on older systems that are constrained not to be able to update Cabal. Alan On Fri, Sep 6, 2013 at 7:29 AM, Kazu Yamamoto k...@iij.ad.jp wrote: Hi all, I have just uploaded ghc-mod v3.0.0 to Hackage. In this version, ghc-mod supports the sandbox feature of cabal-install. Instead, it stopped supporting cabal-dev. If you want to use ghc-mod v3.0.0, I would recommand to install cabal-install 1.18. The sandbox in your package is automatically detected by ghc-mod if exists. --Kazu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc-mod v3.0.0
Ok, thanks. On Fri, Sep 6, 2013 at 9:52 AM, Kazu Yamamoto k...@iij.ad.jp wrote: Alan, Is this backward compatible with older versions of Cabal? I am considering whether to migrate HaRe to use this, I would prefer not to have it then fail to work on older systems that are constrained not to be able to update Cabal. The sandbox is a feature of cabal-install, not Cabal lib. I carefully implemented this version not using Cabal 1.18. --Kazu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Haskell Refactorer (HaRe) version 0.7.0.0
I am please to announce an alpha release of the Haskell Refactorer making use of the GHC API. It is a work in progress, but currently supports the following refactorings iftocase Convert an if expression to a case expression dupdef Duplicate a definition liftToTopLevel Lift a declaration to the top level liftOneLevel Lift a declaration one level demote Move a declaration down one level rename Rename an identifier It offers emacs integration only at this point, based on the Wrangler elisp. The underlying environment in terms of cabal file, sandbox, etc are managed by ghc-mod via the internals exposed in version 2.1.2 There are some known issues (and bound to be plenty of unknown ones too). The most damaging of these is that layout is not adjusted after renaming an identifier if the new name is a different length. This affects layout-sensitive code. Installation instructions can be found at https://github.com/alanz/HaRe/blob/master/README.markdown Regards Alan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANNOUNCE: haskell-src-exts 1.14.0
This is not using haskell-src-exts, but the Haskell Refactorer has a structure to keep a parallel tree of tokens indexed by SrcSpan, which attempts to allocate comments to the appropriate point. See https://github.com/alanz/HaRe/blob/master/src/Language/Haskell/Refact/Utils/TokenUtils.hs. It does not make use of the AST itself, so may be usable with haskell-src-exts Alan On Tue, Aug 20, 2013 at 11:19 AM, Niklas Broberg niklas.brob...@gmail.comwrote: Hi Niklas, 1) My most desired feature would be a syntax tree that does not pluck pluck comments out and make me treat them separately. It looks much easier to me to have a fully descriptive tree and (filter . concatMap) / traverse them out in some way than getting a list of comments and having to insert them back in the right places myself. Is that possible? Sadly not - it's theoretically impossible. The fact that you can put comments literally wherever, means that it's impossible to treat them as nodes of the AST. E.g. f {- WHERE -} x = -- WOULD -- THESE do -- COMMENTS a {- END -} - g x -- UP return {- ? -} a What would be theoretically possible is to define a restricted language that allows comments only in certain well-defined places (cf haddock), and ignores any others. That's a lot of work though, and it's not clear how big the gain is. :-\ A different solution could be to improve the support, through better helper functions, for handling a syntax tree and a list of comments together. That's something I think could be worthwhile. 2) Have you considered downloading the all-of-Hackage tarball and running haskell-src-exts over it to get a benchmark of how much HSE can already parse of the Haskell code out there? Considered, yes. Done, no. Would love to see the results :-). The crew at OdHac (Roman, Erik, Simon) ensured that the current version handles all of 'base', which is a good start. Cheers, Niklas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] getting exported original names using the GHC API
If you use the ParsedSource representation, http://www.haskell.org/ghc/docs/latest/html/libraries/ghc-7.6.3/HsSyn.html#t:HsModule, the LIE entry still has a RdrName which is represented as (IEVar (Qual {ModuleName: L} {OccName: find})))]) On Thu, Jul 4, 2013 at 7:11 PM, Pasqualino Titto Assini tittoass...@gmail.com wrote: Say that I have a module like: module Test(L.find) where import Data.List as L Using the GHC API, I extract the module exports (using GHC.modInfoExports) and I get a list of names. Now, I want to get the name of the export with the namespace stated in the source (L.find) but I seem to be able to get it only as Data.List.find. I have tried different variations of functions on Name or OccName but nothing seems to work. Obviously, I could just parse the module and get the info that way, but I wondered if it could be done via the API. Thanks, titto -- Dr. Pasqualino Titto Assini http://quid2.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: haskell-names-0.1
I took a quick look at this, and came to the conclusion that the scope info is available from GHC, but is not exposed by HaRe at this stage. Rather than chasing something just to show it can be done, I am going to use my limited time for HaRe. By the way, I think buildwrapper generates a summary of a project as as well, in JSON format. Also, for GHC RenamedSource, querying any Name entity will provide the package it came from (via http://www.haskell.org/ghc/docs/7.6.3/html/libraries/ghc-7.6.3/Name.html#v:nameModule ) e.g. (Data.Generics.Text.gshow, syb-0.4.0:Data.Generics.Text), Alan On Fri, Jun 21, 2013 at 9:05 AM, AlanKim Zimmerman alan.z...@gmail.comwrote: I have a feeling the work-in-progress Haskell Refactorer using the GHC API may be able to provide this information through its library interface. When I have some time over the weekend I will have a look. Alan On Fri, Jun 21, 2013 at 8:44 AM, Michael Sloan mgsl...@gmail.com wrote: Roman: Awesome! I'm really glad that this is ready for use! Andrew: I have a tool that's a step towards doing this. Instead of using haskell suite, it uses ghci via hint to query module exports, and then uses TH to reify them. This has the benefit of supporting everything that GHC supports, whereas there are currently some cases that haskell-src-exts can't parse. There's also the issue of supporting declarations generated by template haskell. Here's an example of diffing some of its output: https://github.com/mgsloan/api-compat/blob/master/examples/template-haskell.api.diff The main reason I haven't released the tool is that I was intending to do structural diffs / handle renaming, so it's somewhat unfinished. However I believe it's reasonably usable: instead, the output is just structured in a way that's reasonably amenable to diffing. -Michael On Thu, Jun 20, 2013 at 11:12 PM, Andrew Cowie and...@operationaldynamics.com wrote: On Thu, 2013-06-20 at 18:13 +0300, Roman Cheplyaka wrote: Namely, it can do the following: * for a module, compute its interface, i.e. the set of entities exported by the module, together with their original names. * for each name in the module, figure out what it refers to — whether it's bound locally (say, by a where clause) or globally (and then give its origin). Is this a step toward being able to automatically derive an API version number [in the SO version sense of the word; ie, has a change happened requiring a version bump?] AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: haskell-names-0.1
I have a feeling the work-in-progress Haskell Refactorer using the GHC API may be able to provide this information through its library interface. When I have some time over the weekend I will have a look. Alan On Fri, Jun 21, 2013 at 8:44 AM, Michael Sloan mgsl...@gmail.com wrote: Roman: Awesome! I'm really glad that this is ready for use! Andrew: I have a tool that's a step towards doing this. Instead of using haskell suite, it uses ghci via hint to query module exports, and then uses TH to reify them. This has the benefit of supporting everything that GHC supports, whereas there are currently some cases that haskell-src-exts can't parse. There's also the issue of supporting declarations generated by template haskell. Here's an example of diffing some of its output: https://github.com/mgsloan/api-compat/blob/master/examples/template-haskell.api.diff The main reason I haven't released the tool is that I was intending to do structural diffs / handle renaming, so it's somewhat unfinished. However I believe it's reasonably usable: instead, the output is just structured in a way that's reasonably amenable to diffing. -Michael On Thu, Jun 20, 2013 at 11:12 PM, Andrew Cowie and...@operationaldynamics.com wrote: On Thu, 2013-06-20 at 18:13 +0300, Roman Cheplyaka wrote: Namely, it can do the following: * for a module, compute its interface, i.e. the set of entities exported by the module, together with their original names. * for each name in the module, figure out what it refers to — whether it's bound locally (say, by a where clause) or globally (and then give its origin). Is this a step toward being able to automatically derive an API version number [in the SO version sense of the word; ie, has a change happened requiring a version bump?] AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Promoting Haskell via Youtube movies
This looks like quite a good series https://www.youtube.com/user/jekor On Mon, Jun 17, 2013 at 8:30 PM, Vo Minh Thu not...@gmail.com wrote: Certainly less entertaining but depending on your public, this one with FP Complete's Aaron Contorer can be valuable: http://www.youtube.com/watch?v=Fqi0Xu2Enaw 2013/6/17 Mihai Maruseac mihai.marus...@gmail.com Hi, I was wondering if we have similar movies for Haskell as https://www.youtube.com/watch?v=kLO1djacsfg and https://www.youtube.com/watch?v=E3418SeWZfQ exist for Java. I indend to give them to some people to make them intrigued by the language and start learning it / looking for it. -- MM All we have to decide is what we do with the time that is given to us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Testing invasive proposals with Hackager
Roman Cheplyaka has written a tool called HasFix for updating source based on new versions of libraries. The presentation on it is here http://ro-che.info/docs/ and the code is at https://github.com/feuerbach/hasfix Perhaps it could be pressed into use for automatic update of historical code? Alan On Thu, Jun 13, 2013 at 6:30 PM, Maksymilian Owsianny maksymilian.owsia...@gmail.com wrote: I was thinking about something similar some time ago, but not just testing but also fixing things automatically. Taking for example Semigroup = Monoid this would break in places where you have instance for Monoid but don't have instance for Semigroup. But if you have instance for Monoid making instance for Semigroup is straightforward: instance Semigroup TypeYouAreFixing where () = copy code from mappend for that type I'm still kind of new to Haskell, so I'm not sure how hard such, TemplateHaskell-like automagic migration tool, would be to make, but I feel like such a tool would be of incredible importance for the community. Because otherwise, without such thing, there are usually two ways a language can evolve: 1. Caring for backwards compatibility, and accumulating mistakes like that over time, and becoming more and more like crap. 2. Making fixes that break everyones code, and because of that being ignored by the industry. I like Haskell because it usually takes the second route, but as community grows it will be less and less the case. With such a tool you could have best of both worlds. Though I assume that somebody already thought of that and come to the conclusion that in general case you cannot make such tool because Gödel is a bastard that breaks everyones toys, or something along this lines. On Thu, Jun 13, 2013 at 12:54 PM, Niklas Hambüchen m...@nh2.me wrote: On 13/06/13 18:36, Vo Minh Thu wrote: For example, here is a run with GHC, no special options and using 4 threads (note that this generally takes a long time, i.e. a few days): My builds finished in 10 hours on an i7. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] voting sytem DSL
Have you looked at http://frictionfreedemocracy.org/ They are using https://github.com/agocorona/Workflow amongst other things to define election work flows. Alan On Jun 5, 2013 11:25 PM, Corentin Dupont corentin.dup...@gmail.com wrote: Hi haskellers! I am trying to make a DSL able to describe a voting system. That DSL should be able to describe many different voting procedures: unanimity or majority, open or secret ballot, one or two turns... It should also work for referendums (yes/no question) or elections (electing one or several people)... Are you aware of any such DSL? In Haskell I haven't see it, maybe in another language? Cheers, Corentin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe