Re: Safe Haskell trust

2014-03-17 Thread Daniel Gorín
Hi Fabian, In general, the behavior you get from hint should be more or less the same one you would observe in ghci, the mapping being roughly: loadModules ~~~ :load setImports :module In ghci, if you have a package installed (and is not hidden in your session), then I believe you can

Re: A language extension for dealing with Prelude.foldr vs Foldable.foldr and similar dilemmas

2013-05-27 Thread Daniel Gorín
Hi Iavor, On May 27, 2013, at 6:18 PM, Iavor Diatchki wrote: Hello, On Fri, May 24, 2013 at 12:42 AM, Daniel Gorín dgo...@dc.uba.ar wrote: On May 24, 2013, at 9:28 AM, Simon Peyton-Jones wrote: How about (in Haskell98) module Data.List ( foldr, ...) import qualified

Re: A language extension for dealing with Prelude.foldr vs Foldable.foldr and similar dilemmas

2013-05-25 Thread Daniel Gorín
should affect only the module system, where it is determined what the type of an imported symbol is. In particular, the typechecker would go unaware of it. In that sense, I see the proposal as a very mild extension. Thanks, Daniel. Simon | -Original Message- | From: Daniel Gorín

Re: A language extension for dealing with Prelude.foldr vs Foldable.foldr and similar dilemmas

2013-05-24 Thread Daniel Gorín
is to make Data.List reexport Data.Foldable.foldr (with a more specialized type) so that the module above can be accepted. Thanks, Daniel Simon | -Original Message- | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell- | users-boun...@haskell.org] On Behalf Of Daniel

A language extension for dealing with Prelude.foldr vs Foldable.foldr and similar dilemmas

2013-05-23 Thread Daniel Gorín
Hi all, Given the ongoing discussion in the libraries mailing list on replacing (or removing) list functions in the Prelude in favor of the Foldable / Traversable generalizations, I was wondering if this wouldn't be better handled by a mild (IMO) extension to the module system. In a

Re: [Haskell-cafe] ghc-mtl, hint, mueval for ghc-7.6 ?

2012-10-08 Thread Daniel Gorín
Hi Johannes, The repository version of ghc-mtl already compiles with ghc 7.6.1. I'm working at the moment on making hint compile again as well (am I the only one on this list that doesn't get excited with every new release of ghc? :)), then I'll upload both to hackage. Thanks, Daniel On Oct

Re: [Haskell-cafe] hint and type synonyms

2012-04-01 Thread Daniel Gorín
in a library (and make sure that it is installed before running the program). Hope this helps... Daniel On Mar 31, 2012, at 8:06 PM, Claude Heiland-Allen wrote: Hi Daniel, cafe, On 31/03/12 17:47, Daniel Gorín wrote: Could you provide a short example of the code you'd like to write

Re: [Haskell-cafe] efficient chop

2011-09-14 Thread Daniel Gorín
On Sep 14, 2011, at 5:29 AM, Kazu Yamamoto (山本和彦) wrote: Hello, Of course, I use ByteString or Text for real programming. But I would like to know whether or not there are any efficient methods to remove a tail part of a list. --Kazu In that case, I would prefer this version, since it

Re: [Haskell-cafe] ghc-mtl and ghc-7.2.1

2011-09-07 Thread Daniel Gorín
Hi Romildo, you can try the darcs version of ghc-mtl [1], I don't know if that will be enough to build lambdabot, though Best, Daniel [1] http://darcsden.com/jcpetruzza/ghc-mtl On Sep 7, 2011, at 1:34 PM, José Romildo Malaquias wrote: Hello. In order to compile ghc-mtl-1.0.1.0 (the latest

Re: [Haskell-cafe] ghc-mtl and ghc-7.2.1

2011-09-07 Thread Daniel Gorín
Hi Romildo, you can try the darcs version of ghc-mtl [1], I don't know if that will be enough to build lambdabot, though Best, Daniel [1] http://darcsden.com/jcpetruzza/ghc-mtl On Sep 7, 2011, at 1:34 PM, José Romildo Malaquias wrote: Hello. In order to compile ghc-mtl-1.0.1.0 (the latest

Re: [Haskell-cafe] External system connections

2011-07-11 Thread Daniel Gorín
On Jul 11, 2011, at 10:48 PM, Alistair Bayley wrote: 12 July 2011 05:49, Michael Snoyman mich...@snoyman.com wrote: As for Bryan's resource-pool: currently I would strongly recommend *against* using it for any purpose. It is based on MonadCatchIO-transformers[2], which is a subtly broken

Re: [Haskell-cafe] generic putback

2011-05-15 Thread Daniel Gorín
I think you need to change the type of putback slightly: import Data.IORef putback :: a - IO a - IO (IO a) putback a action = do next - newIORef a return (do r - readIORef next; writeIORef next = action; return r) main = do getChar' - putback 'a' getChar str - sequence $ take

problem running ghc-api code in ghci 7.0.x

2011-03-02 Thread Daniel Gorín
Hi I have code using the ghc-api that could be run in interactive mode prior to version 7 but now makes ghci crash with a linker error. Everything works fine if compiled before running. I don't know if this is a known issue or if I'm just using the api in the wrong way, but I thought that I

panic parsing a stmt in ghc 7 (possible regression?)

2011-01-31 Thread Daniel Gorín
Hi I'm trying to make the hint library work also with ghc 7 and I'm having problems with some test-cases that are now raising exceptions. I've been able to reduce the problem to a small example. The program below runs ghc in interpreter-mode and attempts to parse an statement using ghc's

Re: [Haskell-cafe] Re: All binary strings of a given length

2010-10-15 Thread Daniel Gorín
I expect this one to run in constant space: import Data.Bits genbin :: Int - [String] genbin n = map (showFixed n) [0..2^n-1::Int] where showFixed n i = map (bool '1' '0' . testBit i) [n-1,n-2..0] bool t f b = if b then t else f Daniel On Oct 15, 2010, at 9:43 AM, Eugene

Re: [Haskell-cafe] ghc api printing of types

2010-07-04 Thread Daniel Gorín
I believe the way is done in hint is something like this (untested): showType t = do -- Unqualify necessary types -- (i.e., do not expose internals) unqual - GHC.getPrintUnqual return $ GHC.showSDocForUser unqual (GHC.pprTypeForUser False t) -- False means 'drop explicit

Re: [Haskell-cafe] Using Hint with a socket server

2010-06-17 Thread Daniel Gorín
Hi Tom, There is probably more than one way to do this. Did you try using the package hint-server? [1] It has a very simple interface: you start a server and obtain a handle; then you can run an interpreter action using the handle. Something like this: runIn handle (interpret msg (as

Re: [Haskell-cafe] How efficient is read?

2010-05-08 Thread Daniel Gorín
On May 9, 2010, at 12:32 AM, Tom Hawkins wrote: I have a lot of structured data in a program written in a different language, which I would like to read in and analyze with Haskell. And I'm free to format this data in any shape or form from the other language. Could I define a Haskell type for

Re: [Haskell-cafe] Hint causes GHCi linker error under Windows

2009-12-12 Thread Daniel Gorín
Hi, Martin Do you have a complete example one can use to reproduce this behavior? (preferably a short one! :P) In any case, I'm resending your message to the glasgow-haskell-users list to see if a ghc guru recognize the error message. It is strange that the problem only manifests on

Re: [Haskell-cafe] Hint causes GHCi linker error under Windows

2009-12-12 Thread Daniel Gorín
Hi, Martin Do you have a complete example one can use to reproduce this behavior? (preferably a short one! :P) In any case, I'm resending your message to the glasgow-haskell-users list to see if a ghc guru recognize the error message. It is strange that the problem only manifests on

Re: [Haskell-cafe] Problems with Language.Haskell.Interpreter and errors

2009-11-11 Thread Daniel Gorín
On Nov 11, 2009, at 5:39 AM, Martin Hofmann wrote: I still have problems and your code won't typecheck on my machine printing the following error: [...] I assume we are using different versions of some packages. Could you please send me the output of your 'ghc-pkg list'. Thanks, Martin

Re: [Haskell-cafe] Problems with Language.Haskell.Interpreter and errors

2009-11-10 Thread Daniel Gorín
On Sep 30, 2009, at 2:20 AM, Martin Hofmann wrote: Thanks a lot. You ought to be able to add a Control.Monad.CatchIO.catch clause to your interpreter to catch this kind of errors, if you want. I forgot to mention that this didn't work for me either. Thanks for the report! You are

Re: [Haskell-cafe] Problems with Language.Haskell.Interpreter and errors

2009-09-29 Thread Daniel Gorín
On Sep 29, 2009, at 8:56 AM, Martin Hofmann wrote: Hi, The API of Language.Haskell.Interpreter says, that 'runInterpreter' runInterpreter :: (MonadCatchIO m, Functor m) = InterpreterT m a - m (Either InterpreterError a) returns 'Left' in case of errors and 'GhcExceptions from

Re: Using the ghc-api to run more than one instance of ghc simultaneously

2009-07-14 Thread Daniel Gorín
On Jul 13, 2009, at 10:53 PM, Marc Weber wrote: Yes, it is a known limitation. It ought to be documented somewhere. There are two problems: 1. GHC is not thread-safe. [...] 2. There is only one RTS linker with a single symbol table. [...] Are there already bug tracker items for these

Using the ghc-api to run more than one instance of ghc simultaneously

2009-07-12 Thread Daniel Gorín
Hi I'm trying to use the GHC API to have several instances of GHC's interpreter loaded simultaneously; each with its own loaded modules, etc. However, this doesn't seem to work well when two instances have loaded modules with the same name. I'm including the code of a small(ish) example

Re: [Haskell-cafe] .hi inconsistency bug.

2009-03-18 Thread Daniel Gorín
should be done testing the solution before I hit the send button... Cabal guys, you rock. Thanks again, Dan. /Joe Daniel Gorín wrote: Hi Just a wild guess but maybe the interpreter is recompiling (in runtime) code that has already been compiled to build your application (in compile-time

Re: [Haskell-cafe] .hi inconsistency bug.

2009-03-17 Thread Daniel Gorín
Hi Just a wild guess but maybe the interpreter is recompiling (in runtime) code that has already been compiled to build your application (in compile-time). This may lead to inconsistencies since a type such as HackMail.Data.Main.Types.Filter may refer to two different (and incompatible)

Re: [Haskell-cafe] .hi inconsistency bug.

2009-03-17 Thread Daniel Gorín
Hi Just a wild guess but maybe the interpreter is recompiling (in runtime) code that has already been compiled to build your application (in compile-time). This may lead to inconsistencies since a type such as HackMail.Data.Main.Types.Filter may refer to two different (and incompatible)

Re: [Haskell-cafe] Hint and Ambiguous Type issue

2009-03-06 Thread Daniel Gorín
to use it, I need to not know it... Perhaps, in fact, I'm doing this wrong. Thanks for the help Daniel, everyone... /Joe Daniel Gorín wrote: Ok, so I've pulled the latest version and the error I get now is: Hackmain.hs:70:43: Ambiguous type variable `a' in the constraint

Re: [Haskell-cafe] Hint and Ambiguous Type issue

2009-03-05 Thread Daniel Gorín
Hi I've downloaded Hackmain from patch-tag, but I'm getting a different error. The error I get is: Hackmain.hs:63:10: No instance for (Data.Typeable.Typeable2 Control.Monad.Reader.Reader) arising from a use of `interpret' at Hackmain.hs:63:10-67 Hint

Re: [Haskell-cafe] Hint and Ambiguous Type issue

2009-03-05 Thread Daniel Gorín
instances in all the appropriate places. And provided a (maybe incorrect? Though I'm fairly sure that shouldn't affect the bug I'm having now) Typeable implementation for Reader, but I still get this ambiguous type. I'll push the current version asap. Thanks. /Joe Daniel Gorín wrote: Hi

Re: length of module name affecting performance??

2009-02-09 Thread Daniel Gorín
http://hackage.haskell.org/trac/ghc/ticket/2884 On Feb 9, 2009, at 10:53 AM, Wolfgang Jeltsch wrote: Am Montag, 29. Dezember 2008 12:54 schrieb Simon Peyton-Jones: What a great bug -- I would never have predicted it, but in retrospect it makes perfect sense. Record selectors had better get

Re: [Haskell-cafe] Newtype deriving with functional dependencies

2009-02-01 Thread Daniel Gorín
On Feb 2, 2009, at 1:06 AM, Louis Wasserman wrote: Is there any sensible way to make newtype FooT m e = FooT (StateT Bar m e) deriving (MonadState) work to give instance MonadState Bar (FooT m e)? That is, I'm asking if there would be a semantically sensible way of modifying

length of module name affecting performance??

2008-12-15 Thread Daniel Gorín
Hi While trying to see if I could make some code run faster I stumbled upon something that looks weird to me: 2x-3x performance loss when a module is renamed to a longer name! Here's what I see with the attached examples: #diff long-modname-ver.hs short-modname-ver.hs 2c2 import

Re: length of module name affecting performance??

2008-12-15 Thread Daniel Gorín
On Dec 15, 2008, at 10:43 PM, Don Stewart wrote: dons: Running time as a function of module name length, http://galois.com/~dons/images/results.png 10 is the magic threshold, where indirections start creeping in. Codegen cost heuristic fail? Given this, could you open a bug ticket for

Re: [Haskell-cafe] propogation of Error

2008-12-05 Thread Daniel Gorín
i would expect to get back the Error from the *first* function in the sequence of functions in checkHeader (oggHeaderError from the oggHeader function). but instead i always see the Error from the *last* function in the sequence, OggPacketFlagError from the OggPacketFlag function. why is

Re: GADT Type Checking GHC 6.10 versus older GHC

2008-11-21 Thread Daniel Gorín
On Nov 21, 2008, at 2:04 PM, Jason Dagit wrote: Hello, [...] My understanding was that from 6.6 to 6.8, GADT type checking was refined to fill some gaps in the soundness. Did that happen again between 6.8 and 6.10 or is 6.10 being needlessly strict here? Thanks, Jason typing rules for

Re: [Haskell-cafe] using ghc as a library

2008-10-26 Thread Daniel Gorín
On Oct 25, 2008, at 8:39 PM, Anatoly Yakovenko wrote: so I am trying to figure out how to use ghc as a library. following this example, http://www.haskell.org/haskellwiki/GHC/As_a_library, i can load a module and examine its symbols: [...] given Test.hs: module Test where hello = hello

Re: gadt changes in ghc 6.10

2008-10-15 Thread Daniel Gorín
Hi, Simon Thanks a lot for your mail. It turns out I could have resolved this by myself (with the help of this thread http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/15153 , to be honest). What I was missing was this key part: bind :: forall a b t. W t a - (a - W t b) - W_ t b

gadt changes in ghc 6.10

2008-10-14 Thread Daniel Gorín
Hi After installing ghc 6.10-rc, I have a program that no longer compiles. I get the dreaded GADT pattern match error, instead :) Here is a boiled-down example: {-# OPTIONS_GHC -XGADTs -XEmptyDataDecls #-} module T where data S data M data Wit t where S :: Wit S M :: Wit M

Re: gadt changes in ghc 6.10

2008-10-14 Thread Daniel Gorín
On Oct 14, 2008, at 7:48 PM, Don Stewart wrote: dgorin: I've tried adding some signatures (together with - XScopedTypeVariables), but with no luck. Why is it that this no longer compiles? More importantly, how can I make it compile again? :) If you work out how to make it compile, can

Re: ghci and source files

2008-07-29 Thread Daniel Gorín
Hi If you just want to compile from (Eclipse) edit buffers instead of source files, I think you can do this with the ghc api. Look at the Target type. The following is pasted from main/HscTypes.lhs -- | A compilation target. -- -- A target may be supplied with the actual text of the --

Re: ghci and source files

2008-07-29 Thread Daniel Gorín
On Jul 29, 2008, at 2:43 PM, Johannes Waldmann wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 data Target = Target TargetId (Maybe (StringBuffer,ClockTime)) looks great. How is this intended to be used, i.e. what should happen if there is an edit/save event in the IDE? Then the IDE

Re: [Haskell-cafe] Haskell's type system

2008-06-18 Thread Daniel Gorín
On Jun 17, 2008, at 11:08 PM, Don Stewart wrote: Haskell's type system is based on System F, the polymorphic lambda calculus. By the Curry-Howard isomorphism, this corresponds to second-order logic. just nitpicking a little this should read second-order propositional logic, right?

Re: [Haskell-cafe] hint / ghc api and reloading modules

2008-05-31 Thread Daniel Gorín
(Since this can be of interest to those using the ghc-api I'm cc-ing the ghc users' list.) Hi, Evan The odd behavior you spotted happens only with hint under ghc-6.8. It turns out the problem was in the session initialization. Since ghc-6.8 the newSession function no longer receives a

Re: [Haskell-cafe] hint / ghc api and reloading modules

2008-05-31 Thread Daniel Gorín
(Since this can be of interest to those using the ghc-api I'm cc-ing the ghc users' list.) Hi, Evan The odd behavior you spotted happens only with hint under ghc-6.8. It turns out the problem was in the session initialization. Since ghc-6.8 the newSession function no longer receives a

Re: [Haskell-cafe] Problem with Python AST

2008-02-20 Thread Daniel Gorín
Hi Something like this would do? if_ = Compound $ If [(IntLit 6, Suite [] [Break])] Nothing while_ = Compound $ While (IntLit 6) (Suite [] [if_]) Nothing f = Program [while_] -- this one fails -- f2 = Program [if_] newtype Ident = Id String data BinOp = Add | Sub data Exp =

Problem with functional dependencies

2007-11-16 Thread Daniel Gorín
Hi I have some code that uses MPTC + FDs + flexible and undecidable instances that was working fine until I did a trivial modification on another part of the project. Now, GHC is complaining with a very confusing (for me, at least) error message. I've been finally able to reproduce the

Re: Problem with functional dependencies

2007-11-16 Thread Daniel Gorín
Hi, Chris Thanks for your answer. I guess that my intuitions of what functional dependencies and context meant were not very accurate (see below) class C m f n | m - n, f - n where c :: m - f - Bool The m-n functional dependency means that I tell you C x _ z is an instance then you

Re: module containing GADTs no longer compiles in ghc 6.8.0

2007-09-27 Thread Daniel Gorín
Of Daniel | Gorín | Sent: 26 September 2007 17:34 | To: glasgow-haskell-users@haskell.org | Subject: module containing GADTs no longer compiles in ghc 6.8.0 | | Hi | | I just tried to compile a project of mine that builds fine using ghc | 6.6.1 and got many errors like this: | | src/HyLo

module containing GADTs no longer compiles in ghc 6.8.0

2007-09-26 Thread Daniel Gorín
Hi I just tried to compile a project of mine that builds fine using ghc 6.6.1 and got many errors like this: src/HyLo/Formula/NNF.hs:247:48: GADT pattern match in non-rigid context for `Opaque' Tell GHC HQ if you'd like this to unify the context In the pattern: Opaque f' In