[Haskell-cafe] How to extract current bindings from GHCi ?

ducis ducis_cn at 126.com
Sat Apr 26 13:56:05 UTC 2014


Currently I need to manually find the last binding of a value if I want to copy-paste it into an editor. With ':show bindings' I get the result of computation.
Say, if I had input 'let a = 1' and 'let b = a+2' I would only get either 'b = _' or 'b = 3' with ':show bindings', while I actually need 'b = a+2'.
Are there any externel tools that can help?








At 2014-04-26 20:00:04,haskell-cafe-request at haskell.org wrote:
>Send Haskell-Cafe mailing list submissions to
>	haskell-cafe at haskell.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>	http://www.haskell.org/mailman/listinfo/haskell-cafe
>or, via email, send a message with subject or body 'help' to
>	haskell-cafe-request at haskell.org
>
>You can reach the person managing the list at
>	haskell-cafe-owner at haskell.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Haskell-Cafe digest..."
>
>
>Today's Topics:
>
>   1. Re: Unicode Haskell source -- Yippie! (Chris Warburton)
>   2. Re: Unicode Haskell source -- Yippie! (Rustom Mody)
>   3. Haddock CSS (Sylvain Henry)
>   4. Re: [ANN] codex - generate tags file from	dependencies
>      (Luke Taylor)
>   5. Re: Haddock CSS (satvik chauhan)
>   6. Re: Haddock CSS (Sylvain Henry)
>   7. Re: [ANN] codex - generate tags file from	dependencies
>      (Alois Cochard)
>   8. Re: [ANN] codex - generate tags file from	dependencies
>      (Alois Cochard)
>   9. ANN: Cryptol, a DSL for cryptography (Iavor Diatchki)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Fri, 25 Apr 2014 14:02:38 +0100
>From: Chris Warburton <chriswarbo at googlemail.com>
>To: Rustom Mody <rustompmody at gmail.com>
>Cc: Haskell Cafe <haskell-cafe at haskell.org>
>Subject: Re: [Haskell-cafe] Unicode Haskell source -- Yippie!
>Message-ID: <86wqedmuj5.fsf at gmail.com>
>Content-Type: text/plain
>
>Rustom Mody <rustompmody at gmail.com> writes:
>
>> As for APL, it failed for various reasons eg
>> - mixing up assembly language (straight line code with gotos) with
>> functional idioms
>> - the character set was a major hurdle in the 60s. Thats not an issue today
>> when most OSes/editors are unicode compliant
>
>I know it's bikeshedding, but I think Agda and Idris are more relevant
>to Haskell than APL, since their semantics are closer (and they're both
>implemented in Haskell).
>
>Agda makes extensive (ab)use of Unicode identifiers,
>eg. https://github.com/agda/agda-stdlib/blob/master/src/Algebra.agda
>
>Idris specifically avoids Unicode identifiers, for reasons outlined at
>https://github.com/idris-lang/Idris-dev/wiki/Unofficial-FAQ
>
>Personally I prefer working in Idris to Agda, since the Unicode puts me
>off. I usually resort to copy/pasting symbols, which is tedious compared
>to typing names.
>
>Cheers,
>Chris
>
>
>------------------------------
>
>Message: 2
>Date: Fri, 25 Apr 2014 19:00:34 +0530
>From: Rustom Mody <rustompmody at gmail.com>
>To: Chris Warburton <chriswarbo at googlemail.com>
>Cc: Haskell Cafe <haskell-cafe at haskell.org>
>Subject: Re: [Haskell-cafe] Unicode Haskell source -- Yippie!
>Message-ID:
>	<CAJ+TeocfycOCW7BOymd+=O5qCgeOx_iX2Wgz6wB5k_vGapKEuQ at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>On Fri, Apr 25, 2014 at 6:32 PM, Chris Warburton
><chriswarbo at googlemail.com>wrote:
>
>> Rustom Mody <rustompmody at gmail.com> writes:
>>
>> > As for APL, it failed for various reasons eg
>> > - mixing up assembly language (straight line code with gotos) with
>> > functional idioms
>> > - the character set was a major hurdle in the 60s. Thats not an issue
>> today
>> > when most OSes/editors are unicode compliant
>>
>> I know it's bikeshedding, but I think Agda and Idris are more relevant
>> to Haskell than APL, since their semantics are closer (and they're both
>> implemented in Haskell).
>>
>> Agda makes extensive (ab)use of Unicode identifiers,
>> eg. https://github.com/agda/agda-stdlib/blob/master/src/Algebra.agda
>>
>> Idris specifically avoids Unicode identifiers, for reasons outlined at
>> https://github.com/idris-lang/Idris-dev/wiki/Unofficial-FAQ
>>
>> Personally I prefer working in Idris to Agda, since the Unicode puts me
>> off. I usually resort to copy/pasting symbols, which is tedious compared
>> to typing names.
>>
>> Cheers,
>> Chris
>>
>
>Thanks Chris for that evaluation. Not bike-shedding as far as I can see.
>
>Yes input-ing things by some GUI-picker or copy-pasting etc would quickly
>become a major pain.
>I believe that there are roughly these 5 levels to this with
>per-char cost decreasing and fixed cost increasing as we go down
>
>1. GUI-picker (IBUS etc) copy-pasting from the web etc -- ok for arm-chair
>discussions; ridiculous for serious development
>2. Editor based input methods eg tex input-method in emacs
>3. Window-system (X/MS etc) input methods
>4. OS-based input methods
>5. Special purpose hardware-keyboards
>
>I believe 3 makes for a particularly good fixed/variable cost balance point
>
>eg in X-windows if you run this command
>$ setxkbmap -layout "us,gr" -option "grp:switch"
>then typing
>abcdefg
>with right-alt depressed, gives:
>???????
>
>For those who prefer a more moded approach (vi-users?) here is
>$ setxkbmap -option "grp:switch,grp:alt_shift_toggle,grp_led:scroll"
>-layout "us,gr"
>
>This makes the Shift-Alt chord switch in and out (ie toggle) greek keyboard
>with the scroll-lock light as indicator
>
>All this is clearly just an analogy; what we need is not a greek keyboard
>but a keyboard mapping analogous to gr(eek). Try s/gr/apl in the commands
>above for apl which, while distant from haskell gives a taste for what a
>*programmer* can use/make.
>
>regards
>Rusi
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/613bebe5/attachment-0001.html>
>
>------------------------------
>
>Message: 3
>Date: Fri, 25 Apr 2014 15:49:13 +0200
>From: Sylvain Henry <hsyl20 at gmail.com>
>To: haskell-cafe at haskell.org
>Subject: [Haskell-cafe] Haddock CSS
>Message-ID:
>	<CAPmptcW5qPRoASfrDG-JGvDLWJiPPPwFCRNLhDHO3Oz2529Lew at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>Hi,
>
>I have quickly hacked a new CSS for haddock based on ocean.css (see
>attached file).
>
>It has a fixed maximal width and is a little bit lighter. To try it with
>cabal, use:
>> cabal haddock --css=ocean2.css [--hyperlink-source]
>
>Feel free to improve it, I am not that good at web design.
>
>-Sylvain
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/a907d8e2/attachment-0001.html>
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: ocean2.css
>Type: text/css
>Size: 9120 bytes
>Desc: not available
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/a907d8e2/attachment-0001.css>
>
>------------------------------
>
>Message: 4
>Date: Fri, 25 Apr 2014 14:55:04 +0100
>From: Luke Taylor <tekul.hs at gmail.com>
>To: haskell-cafe at haskell.org
>Subject: Re: [Haskell-cafe] [ANN] codex - generate tags file from
>	dependencies
>Message-ID: <535A6938.6000403 at gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>On 24/04/2014 23:54, Alois Cochard wrote:
>> Hi,
>>
>> Just to let you know that I released a tool which allow to generate a
>> tags[1] file for a given cabal project using the sources of all the
>> dependencies of that project.
>>
>
>Hi,
>
>It sounds kind of similar to "haskdogs" 
>(https://github.com/ierton/haskdogs), which I use now. Is there 
>something more sophisticated in there which would make it worth 
>switching :) ?
>
>Luke.
>
>
>
>------------------------------
>
>Message: 5
>Date: Fri, 25 Apr 2014 20:24:43 +0530
>From: satvik chauhan <mystic.satvik at gmail.com>
>To: Sylvain Henry <hsyl20 at gmail.com>
>Cc: haskell-cafe <haskell-cafe at haskell.org>
>Subject: Re: [Haskell-cafe] Haddock CSS
>Message-ID:
>	<CADGcxcmfTC4u7K0yTvFP225e43TAJWf5YNdqiLyoZ50pv4=HYw at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>It would be better if you could put it on github.
>
>PS: "I am not that good at web design" <== being too humble here. It looks
>awesome :).
>
>
>On Fri, Apr 25, 2014 at 7:19 PM, Sylvain Henry <hsyl20 at gmail.com> wrote:
>
>> Hi,
>>
>> I have quickly hacked a new CSS for haddock based on ocean.css (see
>> attached file).
>>
>> It has a fixed maximal width and is a little bit lighter. To try it with
>> cabal, use:
>> > cabal haddock --css=ocean2.css [--hyperlink-source]
>>
>> Feel free to improve it, I am not that good at web design.
>>
>> -Sylvain
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/f3a9fcd7/attachment-0001.html>
>
>------------------------------
>
>Message: 6
>Date: Fri, 25 Apr 2014 17:11:08 +0200
>From: Sylvain Henry <hsyl20 at gmail.com>
>To: satvik chauhan <mystic.satvik at gmail.com>
>Cc: haskell-cafe <haskell-cafe at haskell.org>
>Subject: Re: [Haskell-cafe] Haddock CSS
>Message-ID:
>	<CAPmptcVudfw1jrHOCs6QADftmDHh+FaPhnKF_eC939h3mH8zTg at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>Done: https://github.com/hsyl20/haddock-css
>
>Thank you :)
>
>-Sylvain
>
>
>2014-04-25 16:54 GMT+02:00 satvik chauhan <mystic.satvik at gmail.com>:
>
>> It would be better if you could put it on github.
>>
>> PS: "I am not that good at web design" <== being too humble here. It
>> looks awesome :).
>>
>>
>> On Fri, Apr 25, 2014 at 7:19 PM, Sylvain Henry <hsyl20 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have quickly hacked a new CSS for haddock based on ocean.css (see
>>> attached file).
>>>
>>> It has a fixed maximal width and is a little bit lighter. To try it with
>>> cabal, use:
>>> > cabal haddock --css=ocean2.css [--hyperlink-source]
>>>
>>> Feel free to improve it, I am not that good at web design.
>>>
>>> -Sylvain
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>>
>>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/c6f484aa/attachment-0001.html>
>
>------------------------------
>
>Message: 7
>Date: Fri, 25 Apr 2014 21:58:14 +0100
>From: Alois Cochard <alois.cochard at gmail.com>
>To: Christian Marie <christian at ponies.io>
>Cc: Haskell Cafe <haskell-cafe at haskell.org>
>Subject: Re: [Haskell-cafe] [ANN] codex - generate tags file from
>	dependencies
>Message-ID:
>	<CAJHA+wqaqtFT_pAMUH3MAdXzKhu_HkX_+Bpr7ufOO5SiugXfSA at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>On 25 April 2014 02:37, Christian Marie <christian at ponies.io> wrote:
>
>> On Thu, Apr 24, 2014 at 11:54:29PM +0100, Alois Cochard wrote:
>> > Hi,
>> >
>> > Just to let you know that I released a tool which allow to generate a
>> > tags[1] file for a given cabal project using the sources of all the
>> > dependencies of that project.
>> >
>> > `cabal install codex`
>>
>> Slight issue with base 4.6 installed:
>>
>>         $ cabal install --reinstall codex
>>         Resolving dependencies...
>>         cabal: Could not resolve dependencies:
>>         trying: codex-0.0.1.1 (user goal)
>>         next goal: base (dependency of codex-0.0.1.1)
>>         rejecting: base-4.6.0.1/... (conflict: codex => base>=4.7 &&
>>
>> It does install fine with the .cabal patched to accept:
>>
>>         base >=4.6 && <4.8
>>
>>
>Oh sorry for that!
>I just released a new version with a lower bound constrain at 4.6
>
>
>> > You can simply run `codex update` in one of your cabal project directory
>> > and you'll get a 'codex.tags' file to feed in your favorite text editors.
>> >
>> > It store the source code in the hackage local cache, and it store there
>> as
>> > well the tags file per module (so the tool just aggregate per project).
>> >
>> > I hope it will be useful to other hackers, it's a joy for me in vim when
>> > using unknown libraries.
>> >
>> > Note: This tool actually use `ctags` but that could be easily made
>> > configurable if someone need it, integrating native haskell tagger is an
>> > option too. I personally like using ctags, it's very fast.
>>
>> After generating a tags file with 'codex update', I have a bunch of
>> references
>> to .c and .h files. I can't see ctags being particularly useful for cabal
>> projects but perhaps I'm missing something?
>>
>> I would personally use your tool if it were to provide an aggregate of tag
>> files generated by something like hothasktags.
>>
>>
>This is is because you have to configure your ctags to deal with haskell
>(and also ignore some stuff from cabal), I wanted to explain that part but
>I completely forgot... sorry.
>
>It's actually quite simple, I have just updated the README with an example
>~/.ctags configuration:
>https://github.com/aloiscochard/codex
>
>Be sure to delete all "tags" file in your hackage (as they were generated
>with a miss-configured ctags) before re-running the tool, I'll add a
>command to do that directly from the tool, but for now you can just:
>"find ~/.cabal/packages/hackage.haskell.org -name "tags" -exec rm {} \;"
>
>About `hothasktags`, I'm not sure how fast it is and how big is the
>improvement in term of quality. Maybe you could share with us which
>differences you see?
>
>Honestly I don't care much about having to disambiguate manually (as i did
>that with other languages) and I don't think there is others difference vs
>using a haskell tagger, but I understand some might prefer a native tagger
>in which case it should be pretty trivial to plug hothasktags on any other
>tagger on it.
>
>Using a tool which work cross language is actually very powerful, for
>example I have a githook which tag the source of the project itself [1] ...
>it work for all my git based project, doesn't matter which language.
>
>I hope that help
>
>[1]
>https://github.com/aloiscochard/configurations/tree/master/.git_template/hooks
>
>
>> --
>> Christian Marie - Sparkly Code Princess
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
>
>-- 
>*Alois Cochard*
>http://aloiscochard.blogspot.com
>http://twitter.com/aloiscochard
>http://github.com/aloiscochard
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/126ad56c/attachment-0001.html>
>
>------------------------------
>
>Message: 8
>Date: Fri, 25 Apr 2014 22:14:08 +0100
>From: Alois Cochard <alois.cochard at gmail.com>
>To: Luke Taylor <tekul.hs at gmail.com>
>Cc: Haskell Cafe <haskell-cafe at haskell.org>
>Subject: Re: [Haskell-cafe] [ANN] codex - generate tags file from
>	dependencies
>Message-ID:
>	<CAJHA+wpcsh-ZxkyEfDKRqPryOx0iJRg22f+btk1d3O-BsyDEtg at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>On 25 April 2014 14:55, Luke Taylor <tekul.hs at gmail.com> wrote:
>
>> On 24/04/2014 23:54, Alois Cochard wrote:
>>
>>> Hi,
>>>
>>> Just to let you know that I released a tool which allow to generate a
>>> tags[1] file for a given cabal project using the sources of all the
>>> dependencies of that project.
>>>
>>>
>> Hi,
>>
>> It sounds kind of similar to "haskdogs" (https://github.com/ierton/
>> haskdogs), which I use now. Is there something more sophisticated in
>> there which would make it worth switching :) ?
>>
>> Luke.
>>
>
>Hi Luke,
>
>I don't think there is much differences in term of functionality, but there
>is clearly lot of difference in term of design (which you might not care at
>all as everything work fine for you!).
>Basically haskdogs is a shell script ported to haskell, so it rely on
>command line tools. OTHO codex use Cabal as a library and and deal with
>hackage directly... the only external command it use is `ctags`.
>
>If I were to integrate hasktags, I would do it as a library which would
>make possible to remove completely the platform dependency (basically atm
>it's only linux/macos, but then it could work on windows).
>
>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
>
>-- 
>*Alois Cochard*
>http://aloiscochard.blogspot.com
>http://twitter.com/aloiscochard
>http://github.com/aloiscochard
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/b39a2377/attachment-0001.html>
>
>------------------------------
>
>Message: 9
>Date: Fri, 25 Apr 2014 16:14:18 -0700
>From: Iavor Diatchki <iavor.diatchki at gmail.com>
>To: Haskell Cafe <haskell-cafe at haskell.org>
>Subject: [Haskell-cafe] ANN: Cryptol, a DSL for cryptography
>Message-ID:
>	<CAGK9nupBLUELnDeHUZyPYy=+6SR=Qw2e3fvhMVCeBqspAgsEqA at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>Hello,
>
>Galois is happy to announce the first open source release of Cryptol!
> Please visit Cryptol's website for documentation, source code, and
>information on how to contribute:
>
>http://www.cryptol.net/
>
>Cryptol is a domain-specific language for specifying cryptographic
>algorithms. A Cryptol implementation of an algorithm resembles its
>mathematical specification more closely than an implementation in a general
>purpose language.  Furthermore, Cryptol shares lots of similarities with
>Haskell so, hopefully, Haskell programmers should be able to start writing
>Cryptol programs fairly quickly.
>
>Last, but not least, we are always interested in contributors!  So, if you
>think of a cool new feature, or discover an annoying bug, please don't be
>afraid to have a look at the source code.  At present, we think that the
>easiest way to manage contributions is by using github's fork model, so
>just sand us a pull request.
>
>Also, if you have questions about the source code or the Cryptol language,
>please feel free to drop me an e-mail or a message on git-hub (I am user
>"yav").
>
>Happy hacking,
>-Iavor and the Cryptol team
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140425/076f2028/attachment-0001.html>
>
>------------------------------
>
>Subject: Digest Footer
>
>_______________________________________________
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>------------------------------
>
>End of Haskell-Cafe Digest, Vol 128, Issue 46
>*********************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140426/6dc80c39/attachment.html>


More information about the Haskell-Cafe mailing list