From john at repetae.net Sun May 11 20:20:45 2014 From: john at repetae.net (John Meacham) Date: Sun, 11 May 2014 13:20:45 -0700 Subject: [jhc] ANNOUNCE: jhc-0.8.1 Message-ID: After a hiatus, jhc 0.8.1 is released. http://repetae.net/computer/jhc - New license, jhc is now released under a permissive BSD style licence rather than the GPL. The license is compatible with that of ghc allowing code mixing between them. - New library layout based around the standards, there are now haskell98 and haskell2010 packages that are guarenteed to be future proof strictly compatible with the respective standards. A package haskell-extras contains the additonal libraries from ghc's base. - Native support for complex and vector SIMD primitives, exposed via type functions. for instance 'foo :: Complex_ Float32_' for hardware accelerated complex 32 bit floats for instance. These are unboxed only for now, full library Num support in the works. - support for android as a target, you must install the android NDK to use this. - Support for embedded ARM architectures imported from Kiwamu Okabe's branch allowing targeting bare hardware with no OS. - user defined kinds, introduced with the 'kind' keyword otherwise looking like 'type' declarations. - export/import lists now allow namespace qualifiers kind, class, type, or data to explicitly only import or export the specific named entity. As an extension allowed by this, classes and types no longer are in the same namespace and can share names. - ForeignPtr's now have working finalizers when collected by the RTS. - CTYPE pragma to allow promoting arbitrary C types to FFIable entities. From john at repetae.net Sun May 11 20:34:47 2014 From: john at repetae.net (John Meacham) Date: Sun, 11 May 2014 13:34:47 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: <536FDD0F.50601@henning-thielemann.de> References: <536FDD0F.50601@henning-thielemann.de> Message-ID: On Sun, May 11, 2014 at 1:26 PM, Henning Thielemann wrote: > Could you clarify the current relation between jhc and ajhc. Are they > independent from each other, or does ajhc still pull all features from jhc? I try to pull what I can back from ajhc, I had to take a break from developing jhc for a bit (grumble) so it was easier for kiwamu to branch on his own. As long as we don't diverge too much, there shouldn't be an issue sharing any patches between them. I don't see us diverging much as kiwamu is working mainly on the embedded targets, I'm in the process of revamping the intermediate representation to allow faster/better/easier optimizations and fixing some warts on the type system with the powers of hindsight and some inspiring papers by SPJ :) John From kiwamu at debian.or.jp Sun May 11 22:31:50 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Mon, 12 May 2014 07:31:50 +0900 Subject: [jhc] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: Hi John! So great to release new jhc!!! -- Kiwamu Okabe at METASEPI DESIGN From kiwamu at debian.or.jp Sun May 11 22:33:04 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Mon, 12 May 2014 07:33:04 +0900 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: <536FDD0F.50601@henning-thielemann.de> Message-ID: Hi John. On Mon, May 12, 2014 at 5:34 AM, John Meacham wrote: > I try to pull what I can back from ajhc, I had to take a break from > developing jhc for a bit (grumble) so it was easier for kiwamu to > branch on his own. As long as we don't diverge too much, there > shouldn't be an issue sharing any patches between them. I don't see us > diverging much as kiwamu is working mainly on the embedded targets, I'll try to darcs-send Ajhc's remain patch to jhc. > I'm in the process of revamping the intermediate representation to > allow faster/better/easier optimizations and fixing some warts on the > type system with the powers of hindsight and some inspiring papers by > SPJ :) Umm.... I'll try to understand your design, and believe your design is so crazy. ;) Thank's a lot for your brain, -- Kiwamu Okabe at METASEPI DESIGN From john at repetae.net Mon May 12 07:30:52 2014 From: john at repetae.net (John Meacham) Date: Mon, 12 May 2014 00:30:52 -0700 Subject: [jhc] darcs patch: Fixer/VMap: avoid clashing with Data.Typ... (and 1 more) In-Reply-To: <20140512072211.AE0F3E05F914@sf.home> References: <20140512072211.AE0F3E05F914@sf.home> Message-ID: Thanks! Patches have been applied and pushed. John On Mon, May 12, 2014 at 12:22 AM, Sergei Trofimovich wrote: > 2 patches for repository http://repetae.net/repos/jhc: > > Mon May 12 10:15:45 FET 2014 Sergei Trofimovich > * Fixer/VMap: avoid clashing with Data.Typeable.Proxy > > Fails on ghc-7.8 thusly: > [ 83 of 182] Compiling Fixer.VMap ( src/Fixer/VMap.hs, src/Fixer/VMap.o ) > > src/Fixer/VMap.hs:29:28: > Ambiguous occurrence Proxy > It could refer to either Fixer.VMap.Proxy , > defined at src/Fixer/VMap.hs:33:1 > or Data.Typeable.Proxy , > imported from Data.Typeable at src/Fixer/VMap.hs:16:1-20 > (and originally defined in Data.Proxy ) > > Mon May 12 10:21:14 FET 2014 Sergei Trofimovich > * Util.Interact: fix build failure against readline > > On ghc with both readline and editline enabled fails thusly: > [ 84 of 182] Compiling Util.Interact ( src/Util/Interact.hs, src/Util/Interact.o ) > > src/Util/Interact.hs:41:5: > Not in scope: setCompletionEntryFunction > > src/Util/Interact.hs:42:10: > Not in scope: readline > Perhaps you meant one of these: > readLine (line 40), readFile (imported from IO) > > src/Util/Interact.hs:46:19: Not in scope: addHistory > src/Util/Interact.hs:154:29: Not in scope: addHistory > src/Util/Interact.hs:188:19: Not in scope: addHistory > > > [Fixer/VMap: avoid clashing with Data.Typeable.Proxy > Sergei Trofimovich **20140512071545 > Ignore-this: 10d60bdf29789790a666b6231575f1b1 > > Fails on ghc-7.8 thusly: > [ 83 of 182] Compiling Fixer.VMap ( src/Fixer/VMap.hs, src/Fixer/VMap.o ) > > src/Fixer/VMap.hs:29:28: > Ambiguous occurrence 'Proxy' > It could refer to either 'Fixer.VMap.Proxy', > defined at src/Fixer/VMap.hs:33:1 > or 'Data.Typeable.Proxy', > imported from 'Data.Typeable' at src/Fixer/VMap.hs:16:1-20 > (and originally defined in 'Data.Proxy') > ] hunk ./src/Fixer/VMap.hs 16 > )where > > import Data.Monoid(Monoid(..)) > -import Data.Typeable > +import qualified Data.Typeable as T -- qualified to avoid clashing with T.Proxy > import List(intersperse) > import qualified Data.Map as Map > import qualified Data.Set as Set > hunk ./src/Fixer/VMap.hs 31 > vmapArgs :: Map.Map (n,Int) (VMap p n), > vmapNodes :: Either (Proxy p) (Set.Set n) > } > - deriving(Typeable) > + deriving(T.Typeable) > > data Proxy p = Proxy p | DepthExceeded > hunk ./src/Fixer/VMap.hs 34 > - deriving(Eq,Ord,Typeable) > + deriving(Eq,Ord,T.Typeable) > > instance Show p => Show (Proxy p) where > showsPrec n (Proxy p) = showsPrec n p > [Util.Interact: fix build failure against readline > Sergei Trofimovich **20140512072114 > Ignore-this: b064847e105d135da3358607654de267 > > On ghc with both readline and editline enabled fails thusly: > [ 84 of 182] Compiling Util.Interact ( src/Util/Interact.hs, src/Util/Interact.o ) > > src/Util/Interact.hs:41:5: > Not in scope: 'setCompletionEntryFunction' > > src/Util/Interact.hs:42:10: > Not in scope: 'readline' > Perhaps you meant one of these: > 'readLine' (line 40), 'readFile' (imported from IO) > > src/Util/Interact.hs:46:19: Not in scope: 'addHistory' > src/Util/Interact.hs:154:29: Not in scope: 'addHistory' > src/Util/Interact.hs:188:19: Not in scope: 'addHistory' > ] hunk ./src/Util/Interact.hs 26 > import IO > #if USE_EDITLINE > ;import System.Console.Editline.Readline > -#elif USE_NOLINE > +#elif USE_READLINE > ;import System.Console.Readline > #endif > > > -- John Meacham - http://notanumber.net/ From john at repetae.net Mon May 12 19:40:48 2014 From: john at repetae.net (John Meacham) Date: Mon, 12 May 2014 12:40:48 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: Hi, I need to update that page, I compile it with the ubuntu ghc and the ubuntu packaged ones. Can you tell me what libraries you are having issues with? the ./configure should tell you the names of any that I expected might be an issue, I'll actually update it to check and report on everything consistently. even ones I expect to come with ghc. If there are compatibility issues between versions that's a bug I can fix. (usually just a 'hiding' or explicit import will fix any such issue) as for the packages i've been testing with fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. Specific versions should not matter from anything back in ghc 7.2 days to now, if there is a bug where it won't compile with a version expected to be found in the wild, please feel free to report it. John On Mon, May 12, 2014 at 12:10 PM, Krzysztof Skrz?tnicki wrote: > Hello, > > I tried compiling jhc from source (compiled version doesn't work on my > system) but after several attempts I just couldn't find a working set of > libraries for it. Can you specify which versions of libraries are known to > work for jhc? > > Best regards, > Krzysztof Skrz?tnicki > > > On Sun, May 11, 2014 at 10:20 PM, John Meacham wrote: >> >> After a hiatus, jhc 0.8.1 is released. >> >> http://repetae.net/computer/jhc >> >> - New license, jhc is now released under a permissive BSD style licence >> rather >> than the GPL. The license is compatible with that of ghc allowing code >> mixing >> between them. >> >> - New library layout based around the standards, there are now haskell98 >> and >> haskell2010 packages that are guarenteed to be future proof strictly >> compatible with the respective standards. A package haskell-extras >> contains >> the additonal libraries from ghc's base. >> >> - Native support for complex and vector SIMD primitives, exposed via type >> functions. for instance 'foo :: Complex_ Float32_' for hardware >> accelerated >> complex 32 bit floats for instance. These are unboxed only for now, full >> library Num support in the works. >> >> - support for android as a target, you must install the android NDK to use >> this. >> >> - Support for embedded ARM architectures imported from Kiwamu Okabe's >> branch >> allowing targeting bare hardware with no OS. >> >> - user defined kinds, introduced with the 'kind' keyword otherwise looking >> like >> 'type' declarations. >> >> - export/import lists now allow namespace qualifiers kind, class, type, or >> data >> to explicitly only import or export the specific named entity. As an >> extension allowed by this, classes and types no longer are in the same >> namespace and can share names. >> >> - ForeignPtr's now have working finalizers when collected by the RTS. >> >> - CTYPE pragma to allow promoting arbitrary C types to FFIable entities. >> _______________________________________________ >> Haskell mailing list >> Haskell at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell > > -- John Meacham - http://notanumber.net/ From john at repetae.net Tue May 13 00:36:43 2014 From: john at repetae.net (John Meacham) Date: Mon, 12 May 2014 17:36:43 -0700 Subject: [jhc] The Wonders of generic applicative traversal routines Message-ID: Before http://repetae.net/drop/TypeSyns_old.hs and after http://repetae.net/drop/TypeSyns_new.hs that's right, the work of a 550 line complicated file done in a few lines. The magic is in FrontEnd.Syn.Traverse where I have a class that recurses over arbitrary source syntax and takes a data HsOps m = HsOps { opHsDecl :: HsDecl -> m HsDecl, opHsExp :: HsExp -> m HsExp, opHsPat :: HsPat -> m HsPat, opHsType :: HsType -> m HsType, opHsStmt :: HsStmt -> m HsStmt } as an argument, by recursively defining your ops by 'tying the knot' each of the routines will recurse down the others. quite handy. Now I have about 2500 lines of code to excise from FrontEnd/. Many improvements to the front end have been put off due to the sheer amount of traversal code that has to modified for every new syntax construct. good times. John -- John Meacham - http://notanumber.net/ From juhp at community.haskell.org Tue May 13 02:56:13 2014 From: juhp at community.haskell.org (Jens Petersen) Date: Tue, 13 May 2014 11:56:13 +0900 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: Thank you for the new release. :) On 13 May 2014 04:40, John Meacham wrote: > as for the packages i've been testing with > > > fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. > and editline ? For me it fails to build on Fedora 20 with the readline package but completes with editline. Krzysztof: maybe try removing or hiding the readline package or posting your build error. :) Jens -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at repetae.net Tue May 13 03:09:55 2014 From: john at repetae.net (John Meacham) Date: Mon, 12 May 2014 20:09:55 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: Yeah, there was a bug in the way it detected editline/readline which has been fixed in the repo. You can run configure with --disable-line to work around it. or change the word USE_NOLINE to USE_READLINE in src/Util/Interact.hs always some silly typo that works its way in somewhere. I should stop the version number shift and declare it 1.0.0 and use the third digit for actual point releases rather than keep the perpetual 0.x.y wasting the first digit. but then I can't hide behind the 'beta' shield anymore. :) John On Mon, May 12, 2014 at 7:56 PM, Jens Petersen wrote: > Thank you for the new release. :) > > On 13 May 2014 04:40, John Meacham wrote: >> >> as for the packages i've been testing with >> >> >> fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. > > > and editline ? > > For me it fails to build on Fedora 20 with the readline package but > completes with editline. > > Krzysztof: maybe try removing or hiding the readline package or posting your > build error. :) > > Jens > -- John Meacham - http://notanumber.net/ From roma at ro-che.info Tue May 13 06:57:39 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 13 May 2014 09:57:39 +0300 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: References: Message-ID: <20140513065739.GB9149@sniper> Nice! See also http://ro-che.info/articles/2013-03-11-generalizing-gfoldl.html http://ro-che.info/articles/2013-03-29-gtraverse-vs-gfoldl.html http://hackage.haskell.org/package/traverse-with-class * John Meacham [2014-05-12 17:36:43-0700] > Before > > http://repetae.net/drop/TypeSyns_old.hs > > and after > > http://repetae.net/drop/TypeSyns_new.hs > > that's right, the work of a 550 line complicated file done in a few lines. > > The magic is in FrontEnd.Syn.Traverse where I have a class that > recurses over arbitrary source syntax and takes a > > data HsOps m = HsOps { > opHsDecl :: HsDecl -> m HsDecl, > opHsExp :: HsExp -> m HsExp, > opHsPat :: HsPat -> m HsPat, > opHsType :: HsType -> m HsType, > opHsStmt :: HsStmt -> m HsStmt > } > > as an argument, by recursively defining your ops by 'tying the knot' > each of the routines will recurse down the others. quite handy. Now I > have about 2500 lines of code to excise from FrontEnd/. > > Many improvements to the front end have been put off due to the sheer > amount of traversal code that has to modified for every new syntax > construct. good times. > > John > > > -- > John Meacham - http://notanumber.net/ > _______________________________________________ > jhc mailing list > jhc at haskell.org > http://www.haskell.org/mailman/listinfo/jhc -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From john at repetae.net Tue May 13 09:56:11 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 02:56:11 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: I modified it so all packages depended on are listed in only a single spot in the configuration to make it easier to change and give much better error messages. see the new http://repetae.net/repos/jhc/configure.ac and the NEEDS_PACKAGE macros. Possibly existing instances are pretty easy to work around, see USE_MONOID_DOC in the config file. I'll make the show instance for identity conditionally defined too, since that seems to be floating around. Having to specify specific versions in the script would be hacky, much better to actually identify the reasons for incompatibility and choose based on that. John On Mon, May 12, 2014 at 10:36 PM, Krzysztof Skrz?tnicki wrote: > Hmm, I'll give it a try, thanks! > As for the other errors for sure there is missing Binary instance for strict > ByteStrings in newest binary package. > Another one is instance for Show (Identity a) which in turn needed to be > commented out because it appeared in newer version of some other package, > don't know which one. > Lastly I get a lot of errors caused by mixing library versions. I *think* > that the problem is that, unlike Cabal, the Makefile specifies -package foo > without specific versions. The result is that, given the fact that I have > more than 1 version of many libraries installed, it tries to build with two > different versions of same library, or so would it seem: 1 is dependency of > other library, the other is from -package specification. I think this is the > case. > This is why I asked for specific versions of all the libraries involved. The > idea was to simply specify *all* of them on command line and/or Makefile. > > Right now I don't have time to replicate the errors, but I will try again > building jhc later. > > > Best regards, > Krzysztof > > > On Tue, May 13, 2014 at 5:09 AM, John Meacham wrote: >> >> Yeah, there was a bug in the way it detected editline/readline which >> has been fixed in the repo. >> >> You can run configure with --disable-line to work around it. or change >> the word USE_NOLINE to USE_READLINE in src/Util/Interact.hs >> >> always some silly typo that works its way in somewhere. I should stop >> the version number shift and declare it 1.0.0 and use the third digit >> for actual point releases rather than keep the perpetual 0.x.y wasting >> the first digit. but then I can't hide behind the 'beta' shield >> anymore. :) >> >> John >> >> On Mon, May 12, 2014 at 7:56 PM, Jens Petersen >> wrote: >> > Thank you for the new release. :) >> > >> > On 13 May 2014 04:40, John Meacham wrote: >> >> >> >> as for the packages i've been testing with >> >> >> >> >> >> >> >> fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. >> > >> > >> > and editline ? >> > >> > For me it fails to build on Fedora 20 with the readline package but >> > completes with editline. >> > >> > Krzysztof: maybe try removing or hiding the readline package or posting >> > your >> > build error. :) >> > >> > Jens >> > >> >> >> >> -- >> John Meacham - http://notanumber.net/ > > -- John Meacham - http://notanumber.net/ From john at repetae.net Tue May 13 10:21:51 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 03:21:51 -0700 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: <20140513065739.GB9149@sniper> References: <20140513065739.GB9149@sniper> Message-ID: Yeah, I have used those before, and still use Data.Data generics in jhc in some places but always found them unwieldy. As you note in your page, .exact structural children and logical children of a type may be different and I found them brittle when I modified a type, I ended up not being able to use standard types like [] and Maybe as much because I occasionally wanted to do more interesting things with traversal. This hybrid explicit dictionary approach that applies the traversal to components in parallel seems to be a sweet spot. I attempted something like it before using typeclasses, but it didn't work because I needed to modify the traversal functions en route sometimes based on dynamic info so anything hardcoded at the type level, even with clever newtype deriving, I found lacking.     John -- John Meacham - http://notanumber.net/ From gtener at gmail.com Tue May 13 11:06:23 2014 From: gtener at gmail.com (=?UTF-8?Q?Krzysztof_Skrz=C4=99tnicki?=) Date: Tue, 13 May 2014 13:06:23 +0200 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: I tried to compile from darcs repo, however I am unable to even run ./configure. 'autoreconf' returns an error: autoreconf configure.ac:17: error: required file 'ac-macros/compile' not found configure.ac:17: 'automake --add-missing' can install 'compile' configure.ac:13: error: required file 'ac-macros/config.guess' not found configure.ac:13: 'automake --add-missing' can install 'config.guess' configure.ac:13: error: required file 'ac-macros/config.sub' not found configure.ac:13: 'automake --add-missing' can install 'config.sub' configure.ac:5: error: required file 'ac-macros/install-sh' not found configure.ac:5: 'automake --add-missing' can install 'install-sh' configure.ac:5: error: required file 'ac-macros/missing' not found configure.ac:5: 'automake --add-missing' can install 'missing' parallel-tests: error: required file 'ac-macros/test-driver' not found parallel-tests: 'automake --add-missing' can install 'test-driver' autoreconf: automake failed with exit status: 1 I don't know how to proceed. On Tue, May 13, 2014 at 11:56 AM, John Meacham wrote: > I modified it so all packages depended on are listed in only a single > spot in the configuration to make it easier to change and give much > better error messages. see the new > http://repetae.net/repos/jhc/configure.ac and the NEEDS_PACKAGE > macros. > > Possibly existing instances are pretty easy to work around, see > USE_MONOID_DOC in the config file. I'll make the show instance for > identity conditionally defined too, since that seems to be floating > around. Having to specify specific versions in the script would be > hacky, much better to actually identify the reasons for > incompatibility and choose based on that. > > John > > On Mon, May 12, 2014 at 10:36 PM, Krzysztof Skrz?tnicki > wrote: > > Hmm, I'll give it a try, thanks! > > As for the other errors for sure there is missing Binary instance for > strict > > ByteStrings in newest binary package. > > Another one is instance for Show (Identity a) which in turn needed to be > > commented out because it appeared in newer version of some other package, > > don't know which one. > > Lastly I get a lot of errors caused by mixing library versions. I *think* > > that the problem is that, unlike Cabal, the Makefile specifies -package > foo > > without specific versions. The result is that, given the fact that I have > > more than 1 version of many libraries installed, it tries to build with > two > > different versions of same library, or so would it seem: 1 is dependency > of > > other library, the other is from -package specification. I think this is > the > > case. > > This is why I asked for specific versions of all the libraries involved. > The > > idea was to simply specify *all* of them on command line and/or Makefile. > > > > Right now I don't have time to replicate the errors, but I will try again > > building jhc later. > > > > > > Best regards, > > Krzysztof > > > > > > On Tue, May 13, 2014 at 5:09 AM, John Meacham wrote: > >> > >> Yeah, there was a bug in the way it detected editline/readline which > >> has been fixed in the repo. > >> > >> You can run configure with --disable-line to work around it. or change > >> the word USE_NOLINE to USE_READLINE in src/Util/Interact.hs > >> > >> always some silly typo that works its way in somewhere. I should stop > >> the version number shift and declare it 1.0.0 and use the third digit > >> for actual point releases rather than keep the perpetual 0.x.y wasting > >> the first digit. but then I can't hide behind the 'beta' shield > >> anymore. :) > >> > >> John > >> > >> On Mon, May 12, 2014 at 7:56 PM, Jens Petersen > >> wrote: > >> > Thank you for the new release. :) > >> > > >> > On 13 May 2014 04:40, John Meacham wrote: > >> >> > >> >> as for the packages i've been testing with > >> >> > >> >> > >> >> > >> >> > fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. > >> > > >> > > >> > and editline ? > >> > > >> > For me it fails to build on Fedora 20 with the readline package but > >> > completes with editline. > >> > > >> > Krzysztof: maybe try removing or hiding the readline package or > posting > >> > your > >> > build error. :) > >> > > >> > Jens > >> > > >> > >> > >> > >> -- > >> John Meacham - http://notanumber.net/ > > > > > > > > -- > John Meacham - http://notanumber.net/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Tue May 13 11:28:23 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 13 May 2014 14:28:23 +0300 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: References: <20140513065739.GB9149@sniper> Message-ID: <20140513112823.GA18718@sniper> * John Meacham [2014-05-13 03:21:51-0700] > Yeah, I have used those before, and still use Data.Data generics in jhc in > some places but always found them unwieldy. As you note in your page, .exact > structural children and logical children of a type may be different and > I found them brittle when I modified a type, I ended up not being able to > use standard types like [] and Maybe as much because I occasionally wanted > to do more interesting things with traversal. To be 100% clear, the approach proposed on that page doesn't have this limitation and doesn't conflate structural and logical children. (Sorry if I'm stating the obvious; I am not sure what you're referring to by "those".) > This hybrid explicit dictionary approach that applies the traversal to > components in parallel seems to be a sweet spot. I attempted something like > it before using typeclasses, but it didn't work because I needed to modify > the traversal functions en route sometimes based on dynamic info so anything > hardcoded at the type level, even with clever newtype deriving, I found > lacking. It's great that it works for you! I guess you're dealing with an intermediate representation of Haskell code. My motivation behind traverse-with-class is dealing with full Haskell AST as defined in haskell-src-exts. An traversal dictionary for that would be enormous, and most of the components would be the same in any particular traversal (but you don't know in advance which ones, of course). So traverse-with-class helped me to manage that complexity. I also had to deal with modifying the traversal; e.g. here's how I propagate scope information in haskell-names: https://github.com/haskell-suite/haskell-names/blob/master/src/Language/Haskell/Names/Open/Base.hs#L54 https://github.com/haskell-suite/haskell-names/blob/master/src/Language/Haskell/Names/Open/Instances.hs It's a small edsl, so it may look weird at first, but it actually worked out pretty nicely. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From john at repetae.net Tue May 13 12:43:48 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 05:43:48 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: autoreconf -i -i installs anything needed that is missing. John On Tue, May 13, 2014 at 4:06 AM, Krzysztof Skrz?tnicki wrote: > I tried to compile from darcs repo, however I am unable to even run > ./configure. 'autoreconf' returns an error: > > autoreconf > configure.ac:17: error: required file 'ac-macros/compile' not found > configure.ac:17: 'automake --add-missing' can install 'compile' > configure.ac:13: error: required file 'ac-macros/config.guess' not found > configure.ac:13: 'automake --add-missing' can install 'config.guess' > configure.ac:13: error: required file 'ac-macros/config.sub' not found > configure.ac:13: 'automake --add-missing' can install 'config.sub' > configure.ac:5: error: required file 'ac-macros/install-sh' not found > configure.ac:5: 'automake --add-missing' can install 'install-sh' > configure.ac:5: error: required file 'ac-macros/missing' not found > configure.ac:5: 'automake --add-missing' can install 'missing' > parallel-tests: error: required file 'ac-macros/test-driver' not found > parallel-tests: 'automake --add-missing' can install 'test-driver' > autoreconf: automake failed with exit status: 1 > > I don't know how to proceed. > > > > On Tue, May 13, 2014 at 11:56 AM, John Meacham wrote: >> >> I modified it so all packages depended on are listed in only a single >> spot in the configuration to make it easier to change and give much >> better error messages. see the new >> http://repetae.net/repos/jhc/configure.ac and the NEEDS_PACKAGE >> macros. >> >> Possibly existing instances are pretty easy to work around, see >> USE_MONOID_DOC in the config file. I'll make the show instance for >> identity conditionally defined too, since that seems to be floating >> around. Having to specify specific versions in the script would be >> hacky, much better to actually identify the reasons for >> incompatibility and choose based on that. >> >> John >> >> On Mon, May 12, 2014 at 10:36 PM, Krzysztof Skrz?tnicki >> wrote: >> > Hmm, I'll give it a try, thanks! >> > As for the other errors for sure there is missing Binary instance for >> > strict >> > ByteStrings in newest binary package. >> > Another one is instance for Show (Identity a) which in turn needed to be >> > commented out because it appeared in newer version of some other >> > package, >> > don't know which one. >> > Lastly I get a lot of errors caused by mixing library versions. I >> > *think* >> > that the problem is that, unlike Cabal, the Makefile specifies -package >> > foo >> > without specific versions. The result is that, given the fact that I >> > have >> > more than 1 version of many libraries installed, it tries to build with >> > two >> > different versions of same library, or so would it seem: 1 is dependency >> > of >> > other library, the other is from -package specification. I think this is >> > the >> > case. >> > This is why I asked for specific versions of all the libraries involved. >> > The >> > idea was to simply specify *all* of them on command line and/or >> > Makefile. >> > >> > Right now I don't have time to replicate the errors, but I will try >> > again >> > building jhc later. >> > >> > >> > Best regards, >> > Krzysztof >> > >> > >> > On Tue, May 13, 2014 at 5:09 AM, John Meacham wrote: >> >> >> >> Yeah, there was a bug in the way it detected editline/readline which >> >> has been fixed in the repo. >> >> >> >> You can run configure with --disable-line to work around it. or change >> >> the word USE_NOLINE to USE_READLINE in src/Util/Interact.hs >> >> >> >> always some silly typo that works its way in somewhere. I should stop >> >> the version number shift and declare it 1.0.0 and use the third digit >> >> for actual point releases rather than keep the perpetual 0.x.y wasting >> >> the first digit. but then I can't hide behind the 'beta' shield >> >> anymore. :) >> >> >> >> John >> >> >> >> On Mon, May 12, 2014 at 7:56 PM, Jens Petersen >> >> wrote: >> >> > Thank you for the new release. :) >> >> > >> >> > On 13 May 2014 04:40, John Meacham wrote: >> >> >> >> >> >> as for the packages i've been testing with >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. >> >> > >> >> > >> >> > and editline ? >> >> > >> >> > For me it fails to build on Fedora 20 with the readline package but >> >> > completes with editline. >> >> > >> >> > Krzysztof: maybe try removing or hiding the readline package or >> >> > posting >> >> > your >> >> > build error. :) >> >> > >> >> > Jens >> >> > >> >> >> >> >> >> >> >> -- >> >> John Meacham - http://notanumber.net/ >> > >> > >> >> >> >> -- >> John Meacham - http://notanumber.net/ > > -- John Meacham - http://notanumber.net/ From john at repetae.net Tue May 13 13:01:36 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 06:01:36 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: Just pushed a patch that will only create the show identity instance if it is missing. If you could test it, that would be great. I assumed if it existed it would come from Control.Monad.Identity, perhaps that is not true though. Also fixed some other #ifdefs that depended on GHC version numbers to use proper HS_HAS_INSTANCE checks. The docs for development mention the requirements for using the darcs tree. http://repetae.net/computer/jhc/development.shtml the prerequisites are a little out of date though. that doc is part of the repo in docs/development.mkd John On Tue, May 13, 2014 at 5:43 AM, John Meacham wrote: > autoreconf -i > > -i installs anything needed that is missing. > > John > > On Tue, May 13, 2014 at 4:06 AM, Krzysztof Skrz?tnicki wrote: >> I tried to compile from darcs repo, however I am unable to even run >> ./configure. 'autoreconf' returns an error: >> >> autoreconf >> configure.ac:17: error: required file 'ac-macros/compile' not found >> configure.ac:17: 'automake --add-missing' can install 'compile' >> configure.ac:13: error: required file 'ac-macros/config.guess' not found >> configure.ac:13: 'automake --add-missing' can install 'config.guess' >> configure.ac:13: error: required file 'ac-macros/config.sub' not found >> configure.ac:13: 'automake --add-missing' can install 'config.sub' >> configure.ac:5: error: required file 'ac-macros/install-sh' not found >> configure.ac:5: 'automake --add-missing' can install 'install-sh' >> configure.ac:5: error: required file 'ac-macros/missing' not found >> configure.ac:5: 'automake --add-missing' can install 'missing' >> parallel-tests: error: required file 'ac-macros/test-driver' not found >> parallel-tests: 'automake --add-missing' can install 'test-driver' >> autoreconf: automake failed with exit status: 1 >> >> I don't know how to proceed. >> >> >> >> On Tue, May 13, 2014 at 11:56 AM, John Meacham wrote: >>> >>> I modified it so all packages depended on are listed in only a single >>> spot in the configuration to make it easier to change and give much >>> better error messages. see the new >>> http://repetae.net/repos/jhc/configure.ac and the NEEDS_PACKAGE >>> macros. >>> >>> Possibly existing instances are pretty easy to work around, see >>> USE_MONOID_DOC in the config file. I'll make the show instance for >>> identity conditionally defined too, since that seems to be floating >>> around. Having to specify specific versions in the script would be >>> hacky, much better to actually identify the reasons for >>> incompatibility and choose based on that. >>> >>> John >>> >>> On Mon, May 12, 2014 at 10:36 PM, Krzysztof Skrz?tnicki >>> wrote: >>> > Hmm, I'll give it a try, thanks! >>> > As for the other errors for sure there is missing Binary instance for >>> > strict >>> > ByteStrings in newest binary package. >>> > Another one is instance for Show (Identity a) which in turn needed to be >>> > commented out because it appeared in newer version of some other >>> > package, >>> > don't know which one. >>> > Lastly I get a lot of errors caused by mixing library versions. I >>> > *think* >>> > that the problem is that, unlike Cabal, the Makefile specifies -package >>> > foo >>> > without specific versions. The result is that, given the fact that I >>> > have >>> > more than 1 version of many libraries installed, it tries to build with >>> > two >>> > different versions of same library, or so would it seem: 1 is dependency >>> > of >>> > other library, the other is from -package specification. I think this is >>> > the >>> > case. >>> > This is why I asked for specific versions of all the libraries involved. >>> > The >>> > idea was to simply specify *all* of them on command line and/or >>> > Makefile. >>> > >>> > Right now I don't have time to replicate the errors, but I will try >>> > again >>> > building jhc later. >>> > >>> > >>> > Best regards, >>> > Krzysztof >>> > >>> > >>> > On Tue, May 13, 2014 at 5:09 AM, John Meacham wrote: >>> >> >>> >> Yeah, there was a bug in the way it detected editline/readline which >>> >> has been fixed in the repo. >>> >> >>> >> You can run configure with --disable-line to work around it. or change >>> >> the word USE_NOLINE to USE_READLINE in src/Util/Interact.hs >>> >> >>> >> always some silly typo that works its way in somewhere. I should stop >>> >> the version number shift and declare it 1.0.0 and use the third digit >>> >> for actual point releases rather than keep the perpetual 0.x.y wasting >>> >> the first digit. but then I can't hide behind the 'beta' shield >>> >> anymore. :) >>> >> >>> >> John >>> >> >>> >> On Mon, May 12, 2014 at 7:56 PM, Jens Petersen >>> >> wrote: >>> >> > Thank you for the new release. :) >>> >> > >>> >> > On 13 May 2014 04:40, John Meacham wrote: >>> >> >> >>> >> >> as for the packages i've been testing with >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. >>> >> > >>> >> > >>> >> > and editline ? >>> >> > >>> >> > For me it fails to build on Fedora 20 with the readline package but >>> >> > completes with editline. >>> >> > >>> >> > Krzysztof: maybe try removing or hiding the readline package or >>> >> > posting >>> >> > your >>> >> > build error. :) >>> >> > >>> >> > Jens >>> >> > >>> >> >>> >> >>> >> >>> >> -- >>> >> John Meacham - http://notanumber.net/ >>> > >>> > >>> >>> >>> >>> -- >>> John Meacham - http://notanumber.net/ >> >> > > > > -- > John Meacham - http://notanumber.net/ -- John Meacham - http://notanumber.net/ From john at repetae.net Tue May 13 13:26:30 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 06:26:30 -0700 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: <20140513112823.GA18718@sniper> References: <20140513065739.GB9149@sniper> <20140513112823.GA18718@sniper> Message-ID: On Tue, May 13, 2014 at 4:28 AM, Roman Cheplyaka wrote: > To be 100% clear, the approach proposed on that page doesn't have this > limitation and doesn't conflate structural and logical children. > (Sorry if I'm stating the obvious; I am not sure what you're referring to by > "those".) Ah, sorry. I was refering to the 'syb' ones. looks like gtraverse is a better primitive. > I guess you're dealing with an intermediate representation of Haskell code. > My motivation behind traverse-with-class is dealing with full Haskell AST as > defined in haskell-src-exts. An traversal dictionary for that would be enormous, > and most of the components would be the same in any particular traversal (but > you don't know in advance which ones, of course). Actually, the data structure I am traversing and haskell-src are quite related and have a common ancestor. They both branched from the same project a long while ago though, Every now and again I consider merging in the changes, maybe after I get done rewriting the existing code with traversals I will look into it again. It would mean there is a lot less code I'd have to modify if I can just swap out traversal routines. > So traverse-with-class helped me to manage that complexity. > > I also had to deal with modifying the traversal; e.g. here's how I propagate > scope information in haskell-names: > > https://github.com/haskell-suite/haskell-names/blob/master/src/Language/Haskell/Names/Open/Base.hs#L54 > https://github.com/haskell-suite/haskell-names/blob/master/src/Language/Haskell/Names/Open/Instances.hs Interesting. On the subject of module and haskell name resolution, A major issue for jhc is how haddock just refuses to deal with code it can't handle and barfs, especially on my module/name resolution which allows fully recursive imports without restriction (based on the formal definition given in http://ogi.altocumulus.org/~hallgren/hsmod/Description.pdf ) With the --annotate-src option, jhc can spit out annotated source specifying exactly where each name maps, still trying to figure out how to get that into haddock though but seeing as how bugs with attached fixes get closed like this (http://trac.haskell.org/haddock/ticket/257) I'm not sure how well that will go. Last time I tried to submit a patch that let haddock skip over extensions it didn't recognize it wasn't put in. > It's a small edsl, so it may look weird at first, but it actually worked out > pretty nicely. I do have aversions to implicit parameters in general, I think this is the first time I've seen them in the wild actually. will have to look at what you are doing with them. John -- John Meacham - http://notanumber.net/ From gtener at gmail.com Tue May 13 14:48:13 2014 From: gtener at gmail.com (=?UTF-8?Q?Krzysztof_Skrz=C4=99tnicki?=) Date: Tue, 13 May 2014 16:48:13 +0200 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: Thanks for the link on development, somehow I missed that. The patch works great, correctly detects that the instance is already there. After installing few other tools (as well as libwww-perl Arch package) and switching back to GHC 7.6.3 I was able to successfully run: ~/sandbox/jhc-darcs/jhc/ autoreconf -i && ./configure --prefix=`pwd`/installdir && make && make install BTW.: I was also succesful in using a cabal sandbox for any libraries involved. I simply created one with "cabal sandbox init" and changed a line in configure.ac from GHCFLAGS="-hide-all-packages -package base" to "GHCFLAGS="-hide-all-packages -package base -package-db=/home/tener/sandbox/jhc-darcs/jhc/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d" I wonder if support for cabal sandboxes would be a welcome feature for building jhc? On Tue, May 13, 2014 at 3:01 PM, John Meacham wrote: > Just pushed a patch that will only create the show identity instance > if it is missing. If you could test it, that would be great. I assumed > if it existed it would come from Control.Monad.Identity, perhaps that > is not true though. Also fixed some other #ifdefs that depended on GHC > version numbers to use proper HS_HAS_INSTANCE checks. > > The docs for development mention the requirements for using the darcs tree. > > http://repetae.net/computer/jhc/development.shtml > > the prerequisites are a little out of date though. that doc is part of > the repo in docs/development.mkd > > John > > On Tue, May 13, 2014 at 5:43 AM, John Meacham wrote: > > autoreconf -i > > > > -i installs anything needed that is missing. > > > > John > > > > On Tue, May 13, 2014 at 4:06 AM, Krzysztof Skrz?tnicki > wrote: > >> I tried to compile from darcs repo, however I am unable to even run > >> ./configure. 'autoreconf' returns an error: > >> > >> autoreconf > >> configure.ac:17: error: required file 'ac-macros/compile' not found > >> configure.ac:17: 'automake --add-missing' can install 'compile' > >> configure.ac:13: error: required file 'ac-macros/config.guess' not > found > >> configure.ac:13: 'automake --add-missing' can install 'config.guess' > >> configure.ac:13: error: required file 'ac-macros/config.sub' not found > >> configure.ac:13: 'automake --add-missing' can install 'config.sub' > >> configure.ac:5: error: required file 'ac-macros/install-sh' not found > >> configure.ac:5: 'automake --add-missing' can install 'install-sh' > >> configure.ac:5: error: required file 'ac-macros/missing' not found > >> configure.ac:5: 'automake --add-missing' can install 'missing' > >> parallel-tests: error: required file 'ac-macros/test-driver' not found > >> parallel-tests: 'automake --add-missing' can install 'test-driver' > >> autoreconf: automake failed with exit status: 1 > >> > >> I don't know how to proceed. > >> > >> > >> > >> On Tue, May 13, 2014 at 11:56 AM, John Meacham > wrote: > >>> > >>> I modified it so all packages depended on are listed in only a single > >>> spot in the configuration to make it easier to change and give much > >>> better error messages. see the new > >>> http://repetae.net/repos/jhc/configure.ac and the NEEDS_PACKAGE > >>> macros. > >>> > >>> Possibly existing instances are pretty easy to work around, see > >>> USE_MONOID_DOC in the config file. I'll make the show instance for > >>> identity conditionally defined too, since that seems to be floating > >>> around. Having to specify specific versions in the script would be > >>> hacky, much better to actually identify the reasons for > >>> incompatibility and choose based on that. > >>> > >>> John > >>> > >>> On Mon, May 12, 2014 at 10:36 PM, Krzysztof Skrz?tnicki > >>> wrote: > >>> > Hmm, I'll give it a try, thanks! > >>> > As for the other errors for sure there is missing Binary instance for > >>> > strict > >>> > ByteStrings in newest binary package. > >>> > Another one is instance for Show (Identity a) which in turn needed > to be > >>> > commented out because it appeared in newer version of some other > >>> > package, > >>> > don't know which one. > >>> > Lastly I get a lot of errors caused by mixing library versions. I > >>> > *think* > >>> > that the problem is that, unlike Cabal, the Makefile specifies > -package > >>> > foo > >>> > without specific versions. The result is that, given the fact that I > >>> > have > >>> > more than 1 version of many libraries installed, it tries to build > with > >>> > two > >>> > different versions of same library, or so would it seem: 1 is > dependency > >>> > of > >>> > other library, the other is from -package specification. I think > this is > >>> > the > >>> > case. > >>> > This is why I asked for specific versions of all the libraries > involved. > >>> > The > >>> > idea was to simply specify *all* of them on command line and/or > >>> > Makefile. > >>> > > >>> > Right now I don't have time to replicate the errors, but I will try > >>> > again > >>> > building jhc later. > >>> > > >>> > > >>> > Best regards, > >>> > Krzysztof > >>> > > >>> > > >>> > On Tue, May 13, 2014 at 5:09 AM, John Meacham > wrote: > >>> >> > >>> >> Yeah, there was a bug in the way it detected editline/readline which > >>> >> has been fixed in the repo. > >>> >> > >>> >> You can run configure with --disable-line to work around it. or > change > >>> >> the word USE_NOLINE to USE_READLINE in src/Util/Interact.hs > >>> >> > >>> >> always some silly typo that works its way in somewhere. I should > stop > >>> >> the version number shift and declare it 1.0.0 and use the third > digit > >>> >> for actual point releases rather than keep the perpetual 0.x.y > wasting > >>> >> the first digit. but then I can't hide behind the 'beta' shield > >>> >> anymore. :) > >>> >> > >>> >> John > >>> >> > >>> >> On Mon, May 12, 2014 at 7:56 PM, Jens Petersen > >>> >> wrote: > >>> >> > Thank you for the new release. :) > >>> >> > > >>> >> > On 13 May 2014 04:40, John Meacham wrote: > >>> >> >> > >>> >> >> as for the packages i've been testing with > >>> >> >> > >>> >> >> > >>> >> >> > >>> >> >> > >>> >> >> > fgl,regex-compat,bytestring,binary,mtl,containers,unix,utf8-string,zlib,HsSyck,filepath,process,syb,old-time,pretty. > >>> >> > > >>> >> > > >>> >> > and editline ? > >>> >> > > >>> >> > For me it fails to build on Fedora 20 with the readline package > but > >>> >> > completes with editline. > >>> >> > > >>> >> > Krzysztof: maybe try removing or hiding the readline package or > >>> >> > posting > >>> >> > your > >>> >> > build error. :) > >>> >> > > >>> >> > Jens > >>> >> > > >>> >> > >>> >> > >>> >> > >>> >> -- > >>> >> John Meacham - http://notanumber.net/ > >>> > > >>> > > >>> > >>> > >>> > >>> -- > >>> John Meacham - http://notanumber.net/ > >> > >> > > > > > > > > -- > > John Meacham - http://notanumber.net/ > > > > -- > John Meacham - http://notanumber.net/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Tue May 13 14:50:48 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 13 May 2014 17:50:48 +0300 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: References: <20140513065739.GB9149@sniper> <20140513112823.GA18718@sniper> Message-ID: <20140513145048.GA23154@sniper> * John Meacham [2014-05-13 06:26:30-0700] > > It's a small edsl, so it may look weird at first, but it actually worked out > > pretty nicely. > > I do have aversions to implicit parameters in general, I think this is the > first time I've seen them in the wild actually. will have to look at what > you are doing with them. Yeah, I know there's a stigma against them; yet I rather like them. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From john at repetae.net Tue May 13 14:58:09 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 07:58:09 -0700 Subject: [jhc] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: On Tue, May 13, 2014 at 7:48 AM, Krzysztof Skrz?tnicki wrote: > I wonder if support for cabal sandboxes would be a welcome feature for > building jhc? What would that entail, would a --with-cabal-sandbox "sandboxconf" option to configure that is passed to -package-db do? That is easy enough to add if it will be helpful. John -- John Meacham - http://notanumber.net/ From roma at ro-che.info Tue May 13 16:12:55 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 13 May 2014 19:12:55 +0300 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: References: Message-ID: <20140513161255.GA26605@sniper> Sjoerd Visscher says: ?You might want to point him to multiplate too, that's an exact match with what he's doing. (I'm not on the jhc mailing list)? (https://twitter.com/sjoerd_visscher/status/466247707699736576) * John Meacham [2014-05-12 17:36:43-0700] > Before > > http://repetae.net/drop/TypeSyns_old.hs > > and after > > http://repetae.net/drop/TypeSyns_new.hs > > that's right, the work of a 550 line complicated file done in a few lines. > > The magic is in FrontEnd.Syn.Traverse where I have a class that > recurses over arbitrary source syntax and takes a > > data HsOps m = HsOps { > opHsDecl :: HsDecl -> m HsDecl, > opHsExp :: HsExp -> m HsExp, > opHsPat :: HsPat -> m HsPat, > opHsType :: HsType -> m HsType, > opHsStmt :: HsStmt -> m HsStmt > } > > as an argument, by recursively defining your ops by 'tying the knot' > each of the routines will recurse down the others. quite handy. Now I > have about 2500 lines of code to excise from FrontEnd/. > > Many improvements to the front end have been put off due to the sheer > amount of traversal code that has to modified for every new syntax > construct. good times. > > John > > > -- > John Meacham - http://notanumber.net/ > _______________________________________________ > jhc mailing list > jhc at haskell.org > http://www.haskell.org/mailman/listinfo/jhc -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From john at repetae.net Tue May 13 22:14:26 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 15:14:26 -0700 Subject: [jhc] darcs patch: src/Support/Inst.hs: don't define instances present in... In-Reply-To: <20140513182026.457D2E137424@sf.home> References: <20140513182026.457D2E137424@sf.home> Message-ID: Cool. thanks. I was actually wondering why those instances didn't exist as they seemed pretty obvious and I almost made them conditional. I'll modify your patch to be an actual feature check with the HAS_TRAVERSABLE_TUPLE check. On Tue, May 13, 2014 at 11:20 AM, Sergei Trofimovich wrote: > 1 patch for repository http://repetae.net/repos/jhc: > > Tue May 13 21:19:19 FET 2014 Sergei Trofimovich > * src/Support/Inst.hs: don't define instances present in ghc-7.8 > > [ 85 of 183] Compiling Support.Inst ( src/Support/Inst.hs, src/Support/Inst.o ) > > src/Support/Inst.hs:7:10: > Duplicate instance declarations: > instance [overlap ok] Foldable ((,) a) > -- Defined at src/Support/Inst.hs:7:10 > instance Foldable ((,) a) -- Defined in 'Data.Foldable' > > src/Support/Inst.hs:9:10: > Duplicate instance declarations: > instance [overlap ok] Traversable ((,) a) > -- Defined at src/Support/Inst.hs:9:10 > instance Traversable ((,) a) -- Defined in 'Data.Traversable' > > > [src/Support/Inst.hs: don't define instances present in ghc-7.8 > Sergei Trofimovich **20140513181919 > Ignore-this: 846e90c9a24c9eccc5c7358078529a72 > > [ 85 of 183] Compiling Support.Inst ( src/Support/Inst.hs, src/Support/Inst.o ) > > src/Support/Inst.hs:7:10: > Duplicate instance declarations: > instance [overlap ok] Foldable ((,) a) > -- Defined at src/Support/Inst.hs:7:10 > instance Foldable ((,) a) -- Defined in 'Data.Foldable' > > src/Support/Inst.hs:9:10: > Duplicate instance declarations: > instance [overlap ok] Traversable ((,) a) > -- Defined at src/Support/Inst.hs:9:10 > instance Traversable ((,) a) -- Defined in 'Data.Traversable' > ] hunk ./src/Support/Inst.hs 1 > +{-# LANGUAGE CPP #-} > module Support.Inst where > > import Control.Applicative > hunk ./src/Support/Inst.hs 8 > import Data.Foldable > import Data.Traversable > > +#if __GLASGOW_HASKELL__ < 708 > instance Foldable ((,) a) where > foldMap = foldMapDefault > instance Traversable ((,) a) where > hunk ./src/Support/Inst.hs 13 > traverse f (x,y) = (,) x <$> f y > +#endif > > instance Functor ((,,) a b) where > fmap = fmapDefault > > -- John Meacham - http://notanumber.net/ From john at repetae.net Tue May 13 22:30:19 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 15:30:19 -0700 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: <20140513161255.GA26605@sniper> References: <20140513161255.GA26605@sniper> Message-ID: Ah, interesting. that looks very very similar. even ends up using the same data type as mine. convergent evolution? I guess the main differences are that a plate is used for all traversal, wereas with my traversal routine a typeclass is used for traversal that decides whether to use the plate on a case by case basis. Which isn't that big of a difference really, both can work like the other just fine. Although mine was originally written with monads in mind, I have dropped that just just applicative functors so they are even converging there. The other difference seems to be that multiplates use a typeclass to 'tie' up the traversal routines to reference each other and I use direct cyclic assignment. as in, instead of declaring ops a plate I do ops = (defaultOps ops) { opHsDecl = \d -> processDecl d } So, we have the same logic, and data structures, we just decided to insert the typeclass at different spots into the framework. :) Incidentally, my next version of E core will be written with generic traversal specifically in mind. I'll run it by the list before I devote to much into it. still working on consistency proofs of the new type system. Integrating the coercions from GHCs system Fc into a stratified pure type system. John On Tue, May 13, 2014 at 9:12 AM, Roman Cheplyaka wrote: > Sjoerd Visscher says: > > ?You might want to point him to multiplate too, that's an exact match with what > he's doing. (I'm not on the jhc mailing list)? > (https://twitter.com/sjoerd_visscher/status/466247707699736576) > > * John Meacham [2014-05-12 17:36:43-0700] >> Before >> >> http://repetae.net/drop/TypeSyns_old.hs >> >> and after >> >> http://repetae.net/drop/TypeSyns_new.hs >> >> that's right, the work of a 550 line complicated file done in a few lines. >> >> The magic is in FrontEnd.Syn.Traverse where I have a class that >> recurses over arbitrary source syntax and takes a >> >> data HsOps m = HsOps { >> opHsDecl :: HsDecl -> m HsDecl, >> opHsExp :: HsExp -> m HsExp, >> opHsPat :: HsPat -> m HsPat, >> opHsType :: HsType -> m HsType, >> opHsStmt :: HsStmt -> m HsStmt >> } >> >> as an argument, by recursively defining your ops by 'tying the knot' >> each of the routines will recurse down the others. quite handy. Now I >> have about 2500 lines of code to excise from FrontEnd/. >> >> Many improvements to the front end have been put off due to the sheer >> amount of traversal code that has to modified for every new syntax >> construct. good times. >> >> John >> >> >> -- >> John Meacham - http://notanumber.net/ >> _______________________________________________ >> jhc mailing list >> jhc at haskell.org >> http://www.haskell.org/mailman/listinfo/jhc -- John Meacham - http://notanumber.net/ From john at repetae.net Tue May 13 22:44:09 2014 From: john at repetae.net (John Meacham) Date: Tue, 13 May 2014 15:44:09 -0700 Subject: [jhc] The Wonders of generic applicative traversal routines In-Reply-To: References: <20140513161255.GA26605@sniper> Message-ID: to +sjoerd visscher Maybe you can help with something I am trying to do, I'd like to parameterize on a traversable over the input as well as the output so, something like where Traversable t and Applicative f current plate definition data Ops f = Ops? {? ? opDecl :: Decl -> f Decl, ? ? opExp ? :: Exp -> f Exp } data OpsT t f = Ops { opDeclT :: t Decl -> f (t Decl) opExpT :: t Exp -> f (t Exp) } where I can specify specify T versions, for instance, override [Decl] -> f [Decl] but otherwise they will automatically default to opDeclT = T.traverse opDecl now, the above is easy to write, tieing it all up recursively and allowing the automatic choosing of the right 'traversable' instance seems hard without ruining encapsulation. See http://repetae.net/repos/jhc/src/FrontEnd/Syn/Traverse.hs for a basic attempt, everything ending with ' is an attempt at the two level idea here. John On Tue, May 13, 2014 at 3:30 PM, John Meacham wrote: > Ah, interesting. that looks very very similar. even ends up using the > same data type as mine. convergent evolution? I guess the main > differences are that a plate is used for all traversal, wereas with my > traversal routine a typeclass is used for traversal that decides > whether to use the plate on a case by case basis. Which isn't that big > of a difference really, both can work like the other just fine. > Although mine was originally written with monads in mind, I have > dropped that just just applicative functors so they are even > converging there. > > The other difference seems to be that multiplates use a typeclass to > 'tie' up the traversal routines to reference each other and I use > direct cyclic assignment. as in, instead of declaring ops a plate I do > > ops = (defaultOps ops) { opHsDecl = \d -> processDecl d } > > So, we have the same logic, and data structures, we just decided to > insert the typeclass at different spots into the framework. :) > > Incidentally, my next version of E core will be written with generic > traversal specifically in mind. I'll run it by the list before I > devote to much into it. still working on consistency proofs of the new > type system. Integrating the coercions from GHCs system Fc into a > stratified pure type system. > > John > > > On Tue, May 13, 2014 at 9:12 AM, Roman Cheplyaka wrote: >> Sjoerd Visscher says: >> >> ?You might want to point him to multiplate too, that's an exact match with what >> he's doing. (I'm not on the jhc mailing list)? >> (https://twitter.com/sjoerd_visscher/status/466247707699736576) >> >> * John Meacham [2014-05-12 17:36:43-0700] >>> Before >>> >>> http://repetae.net/drop/TypeSyns_old.hs >>> >>> and after >>> >>> http://repetae.net/drop/TypeSyns_new.hs >>> >>> that's right, the work of a 550 line complicated file done in a few lines. >>> >>> The magic is in FrontEnd.Syn.Traverse where I have a class that >>> recurses over arbitrary source syntax and takes a >>> >>> data HsOps m = HsOps { >>> opHsDecl :: HsDecl -> m HsDecl, >>> opHsExp :: HsExp -> m HsExp, >>> opHsPat :: HsPat -> m HsPat, >>> opHsType :: HsType -> m HsType, >>> opHsStmt :: HsStmt -> m HsStmt >>> } >>> >>> as an argument, by recursively defining your ops by 'tying the knot' >>> each of the routines will recurse down the others. quite handy. Now I >>> have about 2500 lines of code to excise from FrontEnd/. >>> >>> Many improvements to the front end have been put off due to the sheer >>> amount of traversal code that has to modified for every new syntax >>> construct. good times. >>> >>> John >>> >>> >>> -- >>> John Meacham - http://notanumber.net/ >>> _______________________________________________ >>> jhc mailing list >>> jhc at haskell.org >>> http://www.haskell.org/mailman/listinfo/jhc > > > > -- > John Meacham - http://notanumber.net/ -- John Meacham - http://notanumber.net/