Re: [Haskell-cafe] ANNOUNCE: haskell-names-0.1

2013-06-20 Thread Michael Sloan
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, whe

Re: [Haskell-cafe] Reify type

2013-07-12 Thread Michael Sloan
Hello! I'm not sure if this is what you're asking for, as it doesn't fit that line of code. 'LitT' is a data constructor not a type constructor. So instead it'd be reifyType (LitT ...) = ConE 'LitT ... If this is what you're looking for, then 'lift' is what you want: http://hackage.haskell.org

Re: [Haskell-cafe] Reify type

2013-07-12 Thread Michael Sloan
You might need to cabal update - I recently uploaded a new version to hackage, because I realized the package was a bit out of date from the github repo. It works for me: https://gist.github.com/mgsloan/f9238b2272df43e53896 On Fri, Jul 12, 2013 at 5:49 AM, Jose A. Lopes wrote: > Hello, > > I a

Re: [Haskell-cafe] TH splicing and recompilation checking

2013-07-16 Thread Michael Sloan
Yup, such a thing exists! I think it's a little bit obscure because for some bizarre reason it isn't reexported by Language.Haskell.TH: http://hackage.haskell.org/packages/archive/template-haskell/2.8.0.0/doc/html/Language-Haskell-TH-Syntax.html#v:addDependentFile -Michael On Tue, Jul 16, 2013

Re: [Haskell-cafe] How can I use ghci more wisely?

2013-07-24 Thread Michael Sloan
This portion of haskell-mode (haskell-interactive-mode-eval-pretty) is what the UI for something like this could look like: https://www.youtube.com/watch?v=pu9AGSOySlE This isn't an answer to your question, though, because expanding subparts of the output doesn't drive evaluation. It would be ve

Re: [Haskell-cafe] Can I use String without "" in ghci?

2013-09-01 Thread Michael Sloan
Not that I really want to encourage such a "stringly typed" practice, but it wouldn't really be that much of a stretch. * Use haskell-src-exts[0] and haskell-src-meta[1] to make a quasiquoter that can parse Haskell syntax * Use syb[2] or some other generics to find VarE and ConE expressions. In o

Re: [Haskell-cafe] Is type class 'Addressable' already exists.

2012-04-12 Thread Michael Sloan
eted, clearing a set results in a value that is not the same as "zero". I suppose that "clear" aught to be in a separate class. -Michael Sloan On Wed, Apr 11, 2012 at 10:47 PM, 陈文龙 wrote: > > To get element in List,Map... in python's way. > > > > &

Re: [Haskell-cafe] Is type class 'Addressable' already exists.

2012-04-12 Thread Michael Sloan
stuff - a default definition for lookup cannot be declared inside Indexable. I prefer my class for this - partiality is just (Codomain t ~ Maybe a) - but ekmett likely has his reasons! -Michael Sloan On Thu, Apr 12, 2012 at 1:22 AM, 陈文龙 wrote: > The Indexable class is declared as > &

Re: [Haskell-cafe] Template Haskell: Generate annotated function of a typeclass

2012-04-13 Thread Michael Sloan
n the type variables used in the selected function. -Michael Sloan On Fri, Apr 13, 2012 at 11:37 AM, Ismael Figueroa Palet wrote: > Hi all, I think this is the right place for the following questions and I > thank beforehand for your answers :-) > > > I'm experimenting with typ

Re: [Haskell-cafe] Template Haskell vs Rewrite Rules?

2012-04-19 Thread Michael Sloan
e a bit of work (but could be very useful for other TH quasiquoting stuff!). You might also be interested in this: http://hackage.haskell.org/package/zeroth-2009.6.23.3 Hope that helps! -Michael Sloan On Wed, Apr 18, 2012 at 9:49 AM, Ismael Figueroa Palet wrote: > I'm working on getting

Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-15 Thread Michael Sloan
Upper bounds are a bit of a catch-22 when it comes to library authors evolving their APIs: 1) If library clients aren't encouraged to specify which version of the exported API they target, then changing APIs can lead to opaque compile errors (without any information about which API is intend

Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-17 Thread Michael Sloan
I agree that Haskell's design gives us a good leg up on the problem of acquiring and comparing APIs. However, I don't think that this manifest solution really buys us enough to justify the complexity. There're also some specific, perhaps resolvable, but unsightly problems, which I outline here: ht

Re: [Haskell-cafe] Build regressions due to GHC 7.6

2012-08-30 Thread Michael Sloan
A good way to specify such refactorings is as a Haskell module. For example: module PreludePre_7_6 where import Prelude hiding ( catch ) Or, an example of avoiding the Eq / Show / Num debacle: module PreludePre_7_4 (module Prelude, Num) where import Prelude hiding ( Num ) import qualified P

Re: [Haskell-cafe] Build regressions due to GHC 7.6

2012-08-30 Thread Michael Sloan
Whoops, I messed up that first example: module PreludePre_7_6 (module Prelude, catch) where import Prelude import qualified System.IO.Error as E catch = E.catch On Thu, Aug 30, 2012 at 12:16 PM, Michael Sloan wrote: > A good way to specify such refactorings is as a Haskell module.

Re: [Haskell-cafe] Pattern matching: multi constructors to same branch

2012-09-11 Thread Michael Sloan
I've seen this asked before, and I think some languages support it (ML maybe?). One way to do this is with view patterns: g f C = [f C] g f (getVN -> (v, n)) = f v : g f n getVN v@(A _ n) = (v, n) getVN v@(B _ n) = (v, n) (I changed the recursive call to g - figured you meant passing along f)

Re: [Haskell-cafe] Creating Repa arrays from unboxed vectors

2012-10-04 Thread Michael Sloan
Hello! Perhaps package imports would do the trick? http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#package-imports Not exactly something you'd want to release in a module in a hackage package, though. -Michael On Oct 4, 2012 7:07 AM, "Janek S." wrote: > > so if it's wait

Re: [Haskell-cafe] testing if values can be applied to polymorphic functions

2012-10-24 Thread Michael Sloan
Hey! I was doing similar things with my project "haskellion" ( which I know you've seen because you're the only one that's commented on it - http://www.youtube.com/watch?v=gn_ZZiXVlNY&feature=plcp ). I'm not planning on getting back to work on it anytime soon (there's way too much Haskell stuff I

Re: [Haskell-cafe] Safe lens?

2012-10-29 Thread Michael Sloan
I've never understood this restriction. Template Haskell cannot convert your code to something entirely different, only generate code at splice points. It seems to me like Safe Haskell should already have the necessary mechanisms for Safe Template Haskell to be implemented. The Safe Haskell docs

Re: [Haskell-cafe] Safe lens?

2012-10-29 Thread Michael Sloan
It happened somewhere between 2.6 and 2.7: http://hackage.haskell.org/packages/archive/lens/2.6.1/doc/html/Control-Lens-Internal.html http://hackage.haskell.org/packages/archive/lens/2.7.0.1/doc/html/Control-Lens-Internal.html The strange thing is that the only internal dependency of 2.7.0.1, Con

Re: [Haskell-cafe] Safe lens?

2012-10-29 Thread Michael Sloan
ely > Trustworthy where needed. > > Please let me know if I missed flagged anything you need flagged, or > mis-flagged anything you think shouldn't be. ;) > > > On Mon, Oct 29, 2012 at 5:42 PM, Michael Sloan wrote: >> >> It happened somewhere between 2.6 and 2

Re: [Haskell-cafe] Template Haskell Splicing

2012-12-15 Thread Michael Sloan
I don't think that there is a particular reason for not supporting quasi-quotes in where clauses.. It should be added! The reason for /splices/ to not be supported in here statements is that they are run during type checking. That way calls to "reify" can access type information for things befor

Re: [Haskell-cafe] Hint's setImports usage

2012-12-20 Thread Michael Sloan
Hello! Try doing this first: loadModules ["My.Module"] You may also need to set the "searchPath" - it defaults to the current director. Another good function to know about is "setTopLevelModules", which is just like using ":load" in ghci - it imports everything in the module, including its im

Re: [Haskell-cafe] Hint's setImports usage

2012-12-20 Thread Michael Sloan
ageImports]] > > nor > > {-# LANGUAGE PackageImports #-} > > helps. > > have fun > martin > > > On 21.12.2012 00:55, Michael Sloan wrote: > >> Hello! >> >> Try doing this first: >> >>loadModules ["My.Module"] &g

Re: [Haskell-cafe] Hint's setImports usage

2012-12-20 Thread Michael Sloan
ly on a computer with GHC. If this module is in a package, then there's definitely no way to give it an extra import (it's already compiled). Hope that helps! -Michael On Thu, Dec 20, 2012 at 5:02 PM, Martin Hilbig wrote: > On 21.12.2012 01:23, Michael Sloan wrote: > >> Ye

Re: [Haskell-cafe] Hint's setImports usage

2012-12-22 Thread Michael Sloan
will fail - because it doesn't know that it needs to load your "Prelude.hs" instead of the ordinary one. (Seeing ghci fail in the presence of a "Prelude.hs" is the only reason I thought that this might work - and it did!) Hope that's helpful! -Michael On Thu, Dec

Re: [Haskell-cafe] Documentation operator

2012-12-27 Thread Michael Sloan
I also like this idea a lot! Here're a couple more benefits: 1) This makes it possible to generate documentation from TH - quite handy for things like lens generation / Yesod-like DSLs. 2) The annotation can aid automatically determining how an API has changed. I have a WIP tool[1] that tries to

Re: [Haskell-cafe] xml conduit

2013-02-10 Thread Michael Sloan
I'm no lens authority by any means, but indeed, it looks like something like Cursor / Axis could be done with the lens zipper. https://github.com/snoyberg/xml/blob/0367af336e86d723bd9c9fbb49db0f86d1f989e6/xml-enumerator/Text/XML/Cursor/Generic.hs#L38 This cursor datatype is very much like the (:>

Re: [Haskell-cafe] xml conduit

2013-02-10 Thread Michael Sloan
Err: That first link into Zipper.hs should instead be: https://github.com/ekmett/lens/blob/f8dfe3fd444648f61b8594cd672c25e70c8a30ff/src/Control/Lens/Internal/Zipper.hs#L66 On Sun, Feb 10, 2013 at 9:40 PM, Michael Sloan wrote: > I'm no lens authority by any means, but indeed, it lo

Re: [Haskell-cafe] xml conduit

2013-02-10 Thread Michael Sloan
those. -Michael On Sun, Feb 10, 2013 at 9:41 PM, Michael Sloan wrote: > Err: That first link into Zipper.hs should instead be: > > > https://github.com/ekmett/lens/blob/f8dfe3fd444648f61b8594cd672c25e70c8a30ff/src/Control/Lens/Internal/Zipper.hs#L66 > > > On Sun, Feb 10, 2013 at

Re: [Haskell-cafe] Backward compatibility

2013-05-03 Thread Michael Sloan
Dependency breakage is certainly an unavoidable problem. However, I think Haskell is also in a much better position for having a technical solution to the frustration of breakages. Barring issues with changing datatypes / class instances, we can already express many of the API changes you'd want