GHC on Windows 10 15019+

2017-03-09 Thread J. Garrett Morris
Hi y'all,

I've recently run into a problem using released version of GHC on
Windows 10, builds 15019 and later.  The problem seems to be an
incompatibility with Mingw64---builds fail calling realgcc.exe with
vaguely incomprehensible error messages (Program failed to start with
error 0xc142).

Replacing the packaged version of Mingw64 with a more recent build (from
Msys2, say) restores functioning, but no longer works if there are
spaces in the path to GHC.

I've observed this on three different machines, so I don't think it's
just a configuration oddity.  Has anyone else encountered similar
problems, or can anyone else verify?  If so, it might be worth
repackaging at least the latest released version with a more recent
Mingw64.

 /g

-- 
Prosperum ac felix scelus virtus vocatur
 -- Seneca

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Typed splices and type checking

2015-03-27 Thread J. Garrett Morris
Hello,

I've run into another misunderstanding with Template Haskell and typed
splices.  For example, I was hoping to use typed splices to generate
earlier errors from Printf.  Here's the world's least handy printf:

 class Printf t
 where printf :: String - Q (TExp String) - Q (TExp t)

 instance Printf String
 where printf s t | '%' `notElem` s = [|| $$t ++ s ||]
  | otherwise   = fail (Unexpected format %
++ [c])
   where (_, _:c:_) = break ('%' ==) s

 instance Printf t = Printf (Char - t)
 where printf s t
 | c /= 'c' = fail (Unexpected format % ++ [c] ++
 for character)
 | otherwise = [|| \c - $$(printf s''
  [|| $$t ++ s' ++ [c] ||])
||]
   where (s', '%':c:s'') = break ('%' ==) s

Now, consider these two definitions:

 f :: Char - String
 f = $$(printf foo %c [])

 h :: Char - String
 h y = $$(printf foo %c []) y

I would have expected these to be equivalent, from a type checking
perspective.  However, while the first types fine, the second generates
the error message:

 Printing.hs:14:12:
No instance for (Printf t0) arising from a use of `printf'
The type variable `t0' is ambiguous
Note: there are several potential instances:
  instance Printf t = Printf (Char - t)
-- Defined at Printf.hs:20:10
  instance Printf String -- Defined at Printf.hs:9:10
In the expression: printf foo %c [||  ||]
In the Template Haskell splice
  $$(printf foo %c [||  ||])
In the expression: $$(printf foo %c [||  ||])

Should I have anticipated this?  Ought the interaction of typed splices
and eta-expansion be problematic?

 /g

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Splices returning splices

2015-03-23 Thread J. Garrett Morris
Hello,

I'm attempting to write a quasiquoter with relatively full antiquotation
support.  In doing so, I've arrived at I think an odd problem: the
expression grammar in Language.Haskell.TH.Syntax doesn't seem to include
splices.  This seems to mean that my antiquotations can't themselves
include splices, which is quite limiting.  Am I misinterpreting?  The
type system in Template metaprogramming for Haskell seems to imply no
such restriction on the occurrences of splices.

(As an additional complication: what I really need to do is return typed
splices; my quasiquoter relies on its expected type to determine its
behavior.  However, this seems like an uninteresting extension of the
above problem.)

Thanks,

 /g

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: Splices returning splices

2015-03-23 Thread J. Garrett Morris
On Mon, Mar 23, 2015 at 3:43 PM, Simon Peyton Jones
simo...@microsoft.com wrote:
 A quasiquoter is really a splice. That is [foo| blah |] is the same as
 $(foo blah).  So it might be easier to discuss your question in the
 context of ordinary splices and quotes.  You want foo to return code
 with a splice, thus:

 foo input_string = [| ...$(other_fun args) |]

 But foo is in the Q monad anyway, so why not just run (other_fun args)
 right there in the quasiquoter?

 Or perhaps make a tiny example to show what you mean (but not using
 quasiquotation).

This may not make any sense, but consider something like this:

  $$(p a: 1, b: $$(p \x: 2, y: 3\), c: 3)

Now, my understanding is that 'p' has a type like 'String - Q (TExp
a)', where 'a' is instantiated with the expected type of the resulting
expression.  But I don't see how to synthesize the expected type for the
nested (antiquoted) call to 'p' without implementing my own version of
Haskell type inference.  I'd like to be able to return a term that
includes the antiquoted expression, and then rely on the type checker to
properly make the second call to 'p'.

 /g

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Qualified names in TH?

2015-03-16 Thread J. Garrett Morris
I'm trying to write some Template Haskell code that (among other
things) manipulates IntSets.  So, for example, I'd like a splice to
generate a call to Data.IntSet.fromList.  However, I'm not sure how
IntSet will be imported in the target module.  Is there a way to
resolve the fully qualified name (or similar) to a TH Name, without
having to know how it's imported in the splicing module?  (The obvious
approach---mkName Data.IntSet.fromList---seems not to work in GHC
7.8.)

Thanks!

 /g

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: GHC compilation error (re-post).

2013-01-18 Thread J. Garrett Morris
On Fri, Jan 18, 2013 at 11:32 AM, Brandon Allbery allber...@gmail.com wrote:
 On Fri, Jan 18, 2013 at 1:05 PM, Ben Gamari bgamari.f...@gmail.com wrote:

  on a Win32 (SP3) machine using the Haskell Platform and GHC-7.6.1
  (standalone) and I have noticed the same frustrating errors. Any
  suggestions would be most appreciated.
 
 Are you certain you have write permission for C:\? I'm not terribly with
 how Windows handles file permissions, but the error seems pretty


 I suspect it's more fundamental than that.

 *** Exception: CreateDirectory .: permission denied (Access is denied.)


 Why is it trying to create .?

You can specify -odir with a directory that doesn't exist; perhaps GHC
always tries to create the output directory?

In any case, I can confirm the observed behavior with GHC 7.6.1 on
Windows 8, running with elevated privilege.  It seems to only be a
problem in the root directory tho---while I can observe the problem in
both C:\ and D:\, I can't in any subdirectories thereof.

 /g

-- 
Sent from my mail client.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Advice on type families and non-injectivity?

2013-01-14 Thread J. Garrett Morris
On Mon, Jan 14, 2013 at 3:39 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 There is a real difficulty here with type-checking 'bar'.  (And that
 difficulty is why 'foo' is also rejected.)

This seems, to me, like a somewhat round-about way to express the
problem.  Iavor's explanation (which approach I have also found useful
to explain the behavior of type functions in the past) captures the
ambiguity in both descriptions:

 foo :: (T a ~ b) = b
 foo = undefined

That this is ambiguous should be obvious.  Accepting such a definition
could presumably be used to generate values of undefined type; for
example, I could get a generic instance

 foo :: T Int

whether or not T Int is defined in my program!  This also, to me, seems
to make it clear that past GHC's acceptance of foo was in error.

 /g

--
Sent from my mail client.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: DoCon and GHC

2013-01-03 Thread J. Garrett Morris
On Thu, Jan 3, 2013 at 4:57 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 When matching instances, GHC does not take account of the context of
 the instance. Say you have

 data T a = ...
 data S1 = ...
 data S2 = ...
 [a] instance Num a  = Num (T a) where ...
 [b] instance Show a = Num (T a) where ...
 instance Num S1

 and suppose you need an instance of (Num (T S1)). Then although [a]
 and [b] overlap, you might say we should use [a], since S1 is an
 instance of Num, but not an instance of Show.  But GHC does not do
 this.  It matches instances only based on the bit after the =.

It seems you're making GHC seem more capricious than it is here.  Even
were GHC to consider contexts in instance selection, the choice of [a]
over [b] would still be incoherent: the compiler has no way to prove
that there is no later instance adding S1 to class Show.  Indeed, the
S1's and S2's are in some sense not relevant: because Haskell provides
no mechanism to exclude types from classes, there is no way to ever
coherently use instance [a] or [b], regardless of the argument to T.

 /g

--
Sent from my mail client.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: default instance for IsString

2012-04-24 Thread J. Garrett Morris
On Mon, Apr 23, 2012 at 11:10 PM, Yitzchak Gale g...@sefer.org wrote:
 This is true; the use of polymorphism for numeric literals is also
 unsound.

By this logic, head is unsound, since head [] throws an error.
Haskell types are pointed; Haskell computations can diverge.  What
happens after the computation diverges is irrelevant to type soundness.

 /g


--
Would you be so kind as to remove the apricots from the mashed potatoes?

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: default instance for IsString

2012-04-23 Thread J. Garrett Morris
On Mon, Apr 23, 2012 at 9:58 AM, Yitzchak Gale g...@sefer.org wrote:
 In addition, OverloadedStrings is unsound.

No.  OverloadedStrings treats string literals as applications of
fromString to character list constants.  fromString can throw errors,
just like fromInteger; this is no less sound than any Haskell function
throwing an exception.

 /g


--
Would you be so kind as to remove the apricots from the mashed potatoes?

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Records in Haskell

2012-03-01 Thread J. Garrett Morris
On Wed, Feb 29, 2012 at 11:58 PM, AntC anthony_clay...@clear.net.nz wrote:
 SORF's whadyoumaycalls are at the Kind level. (I'm not opposed to them
 because they're new-fangled, I'm opposed because I can't control the
 namespace.)

Nah, they have kinds, and they don't take parameters, so they're
probably types.  Whether you prefer that foo in module A mean the same
thing as foo in module B is entirely up to you; while it might seem
intuitive to do so, it's also true that if I write

 data List t = Cons t (List t) | Nil

in two different modules, I declare two entirely distinct list types,
even if the natural semantics of the two types might be hard to
distinguish.

 /g

--
Would you be so kind as to remove the apricots from the mashed potatoes?

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Records in Haskell

2012-02-29 Thread J. Garrett Morris
On Wed, Feb 29, 2012 at 11:05 PM, AntC anthony_clay...@clear.net.nz wrote:
 I repeat: nobody is using a type-level string. You (or someone) is
 making it up.

It isn't clear where that idea came from.

On Thu, Sep 15, 2011 at 7:51 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 Yes, it would, and of course any impl of TDNR would need an internal
 constraint similar to your Select.  In my original proposal I was
 hiding that, but it has to be there in the implementation.  But you
 are right that making it explicit might be a good thing.  Esp with
 Julien's new kind stuff (coming soon) we should be able to say

 class Select (rec :: *) (fld :: String) where
   type ResTy rec fld:: *
   get :: rec - ResTy rec fld

 data T = MkT { x,y :: Int }
 instance Select T x where
   get (MkT {x = v}) = v

Oh.

On Mon, Jan 2, 2012 at 4:38 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 It seems to me that there's only one essential missing language feature,
 which is appropriately-kinded type-level strings (and, ideally, the ability
 to reflect these strings back down to the value level).
snip
 Specifically

 * Allow String as a new kind

 * Now you can define classes or types with kinds like

 MyCls :: String - a - Constraint

 T :: String - *

 * Provide type-level string literals, so that “foo” :: String

Huh.

You may want to call your type-level-things-that-identify-fields
strings, labels, fieldLabels, or rumbledethumps, but surely that's not
the point of interest here?

 /g

--
Would you be so kind as to remove the apricots from the mashed potatoes?

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Records in Haskell

2012-02-27 Thread J. Garrett Morris
On Mon, Feb 27, 2012 at 4:52 PM, AntC anthony_clay...@clear.net.nz wrote:
 And can use it, for example:
    getF lastName cust1
    getF fullName person2

 I don't think you can do this is SORF (but please check with SPJ). In
 particular, I don't think you could call this function and pass an argument
 into it for the field name.

You only need some way to write a value of a type of kind String; the
section should Get have a proxy argument of the SORF wiki page
discusses approaches to this problem.  This example demonstrates the
flexibility of the Proxy-based approach, but does not distinguish
between DORF and SORF.

 /g

P.S. Perhaps we should find record proposals that don't sound like
noises my cat makes when coping with a hairball? ;)

--
Would you be so kind as to remove the apricots from the mashed potatoes?

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Records in Haskell

2012-02-24 Thread J. Garrett Morris
On Fri, Feb 24, 2012 at 4:15 PM, Johan Tibell johan.tib...@gmail.com wrote:
 Aside: It is possible to have no scalar fields in records of course.
 data R = C { compare :: (a - a - Ordering) }

Has x f has no semantic content besides type x having an f field; Ord
has (at least in the programmer's mind, even if the language can't check
it) meaning beyond the simple presence of a compare function.

 /g

--
Would you be so kind as to remove the apricots from the mashed potatoes?

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: build-depends

2011-12-22 Thread J. Garrett Morris
On Thu, Dec 22, 2011 at 9:44 AM, Serge D. Mechveliani mech...@botik.ru wrote:
 And  ghc-7.4.0.20111219  reports
    DExport.hs:28:8:
    Could not find module `Random'
    It is a member of the hidden package `haskell98-2.0.0.1'.
    Perhaps you need to add `haskell98' to the build-depends in your .cabal 
 file.

Perhaps import System.Random instead?  Same module, as far as I know,
but that gets it from its real package.

 /g

--
I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: 7.4.1-pre: Show Integral

2011-12-22 Thread J. Garrett Morris
2011/12/22 Edward Kmett ekm...@gmail.com:
 The change, however, was a deliberate _break_ with the standard that
 passed through the library review process a few months ago, and is now
 making its way out into the wild.

Is it reasonable to enquire how many standard-compliant implementations
of Haskell there are?

 /g

--
I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Evaluating type expressions in GHCi

2011-09-20 Thread J. Garrett Morris
On Tue, Sep 20, 2011 at 3:44 PM, Simon Peyton-Jones
simo...@microsoft.com wrote:
 What should the GHCi command be *called*?

:simplify or :simplifytype.  In GHCi at the moment, you could abbreviate
that as short as :si.

 /g

-- 
I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Records in Haskell

2011-09-15 Thread J. Garrett Morris
On Thu, Sep 15, 2011 at 6:03 AM, Barney Hilken b.hil...@ntlworld.com wrote:
 The right way to deal with records is first to agree a mechanism for
 writing a context which means

        a is a datatype with a field named n of type b

 then give the selector n the type

        a is a datatype with a field named n of type b = n :: a - b

 There is no reason why this shouldn't be used with the current syntax
 (although it might clash with more advanced features like first-class
 labels).

Trex is one existing approach in the Haskell design space
http://web.cecs.pdx.edu/~mpj/pubs/polyrec.html
http://web.cecs.pdx.edu/~mpj/pubs/lightrec.html

 /g

-- 
I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Records in Haskell

2011-09-15 Thread J. Garrett Morris
On Thu, Sep 15, 2011 at 7:51 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:

 class Select (rec :: *) (fld :: String) where
  type ResTy rec fld:: *
  get :: rec - ResTy rec fld

 data T = MkT { x,y :: Int }
 instance Select T x where
  get (MkT {x = v}) = v

 And now we desugar
    f.x
 as
    get @T @x f

That's close to our approach, yes.  To avoid the ambiguity in the type
of 'get' (which we call 'select'), we introduce a type constructor

 Lab :: lab - *

to build singleton types out of type-level lables.  Then the Select
class is defined by:

 class Select (t :: *) (f :: lab) = (r :: *)
where select :: t - Lab f - r

and 'f.x' is desugared to 'select f #x' (again, using '#x' as syntax for
the label thingy).  The potential advantage to this approach is that it
allows select to behave normally, without the need to insert type
applications (before type inference); on the other hand, it requires
syntax for the singleton label types.  Take your pick, I suppose. :)

 You probably don't use the idea of extending to arbitrary other
 functions do you?  (Which Ian does not like anyway.)  Something like

    getIndex :: T - Int
    getIndex (MkT x y) = x+y

 Then I'd like to be able to say

        t.getIndex

 So there's an implicit instance
        instance Select T getIndex where
         type ResTy T getIndex = Int
         get = getIndex

We don't support that for arbitrary functions, no.  On the other hand,
our Select class is exposed, so the user can potentially add new
instances; for a silly example in Habit:

 newtype Temperature = Temp Signed

 instance Temperature.celsius = Signed where
   (Temp c).celsius = c

 instance Temperature.fahrenheit = Signed where
   (Temp c).fahrenheit = 32 + (c*9)/5

 It's a little unclear what operations should be in class
 Select.  'get' certainly, but I propose *not* set, because it doesn't
 make sense for getIndex and friends.  So that would mean you could
 write a polymorphic update:

We treat update as a separate class,

 class Update (t :: *) (f :: lab)
where update :: t - Lab f - t.f - t

and desugar update syntax, something like:

 e { x = e' }

to calls to the update function

 update e #x e'

As with Select, this should allow polymorphic update functions:

 updX :: Update f #x = f - f.x - f
 updX f e = f { x = e }

 /g

-- 
I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: multiple module program fails compile

2010-11-15 Thread J. Garrett Morris
On Sat, Nov 13, 2010 at 8:20 AM, Larry Evans cppljev...@suddenlink.net wrote:
 The attached program fails to compile

To the best of my knowledge, GHC doesn't support defining multiple
modules in the same file.  If you move each module to its own file, it
should compile.

 /g

-- 
I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Lazy IO and asynchronous callbacks?

2010-07-08 Thread J. Garrett Morris
Hello everyone,

I'm currently in the process of wrapping a C API, and I've run across
an interesting possibility.  Basically, the C API exposes non-blocking
versions of some potentially long-running operations, and will invoke
a callback to indicate that the long running operation has finished.
For instance, I have something like:

int longRunningReadOperation(int length, byte * buf, void (*callback)())

When callback is called, then there are length bytes in buf.  What I'd
like to do is wrap this in Haskell function like:

longRunningReadOperation :: Int - IO [Byte]

such that the function returns immediately, and only blocks when
someone pulls on the results if the callback hasn't been triggered
yet.  I figure I'm going to need unsafeInterleaveIO, but I'm not sure
what to do in the computation I pass to it.  I had a small hope that
if the callback put the results into an MVar (say var), and I returned
(unsafeInterleaveIO (readMVar var)) that might work, but it seems like
if the readMVar blocks then the callback doesn't execute either.  This
doesn't surprise me, but it does leave me needing another option.  I
don't see a way to get the callback into a new Haskell thread, so that
it can do the putMVar from there... am I missing something obvious?

Thanks in advance!

 /g
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: sum[1..100000] -- stack overflow in GHC, but not in Hugs?

2008-11-23 Thread J. Garrett Morris
On Sun, Nov 23, 2008 at 10:50 AM, Don Stewart [EMAIL PROTECTED] wrote:
 shoot.spam:
 I started off with Hugs and recently used GHC (to use the 'let a  =
 .. syntax interactively, which Hugs doesn't allow perhaps).

 Probably the simplest thing to do is compile the code,

I rather doubt that's the simplest way to use the 'let...' syntax
interactively, actually.

 /g

-- 
I am in here
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Newbish building question

2008-11-12 Thread J. Garrett Morris
Hello,

I've been attempting to add some minor instrumentation to my pet copy
of GHC 6.10.1.  In particular, I'd like to add some code to
extendInstEnv in compiler/types/InstEnv.lhs.

First, I tried importing Debug.Trace into the InstEnv module, and
changing the extendInstEnv function to trace foobar.  This built
file, although was not tremendously useful.

Next, I tried the following modification:

extendInstEnv :: InstEnv - Instance - InstEnv
extendInstEnv inst_env ins_item@(Instance { is_cls = cls_nm, is_tcs = mb_tcs })
 = trace (showSDocDebug (ppr ins_item)) (addToUFM_C add inst_env
cls_nm (ClsIE [ins_item] ins_tyvar))
 where
   add (ClsIE cur_insts cur_tyvar) _ = ClsIE (ins_item : cur_insts)
 (ins_tyvar || cur_tyvar)
   ins_tyvar = not (any isJust mb_tcs)

This produced the following error message:

home/garrett/code/ghc-6.10.1/ghc/stage1-inplace/ghc -package-name
base-4.0.0.0-hide-all-packages -no-user-package-conf -split-objs -i
-idist/build -i. -idist/build/autogen -Idist/build/autogen
-Idist/build -Iinclude -optP-include
-optPdist/build/autogen/cabal_macros.h -#include HsBase.h -odir
dist/build -hidir dist/build -stubdir dist/build -package
ghc-prim-0.1.0.0 -package integer-0.1.0.0 -package rts-1.0 -O
-package-name base -XMagicHash -XExistentialQuantification
-XRank2Types -XScopedTypeVariables -XUnboxedTuples
-XForeignFunctionInterface -XUnliftedFFITypes -XDeriveDataTypeable
-XGeneralizedNewtypeDeriving -XFlexibleInstances -XPatternSignatures
-XStandaloneDeriving -XPatternGuards -XEmptyDataDecls -XCPP
-idist/build  -H32m -O -O2 -Rghc-timing -XGenerics -Wall
-fno-warn-deprecated-flags -c Data/Maybe.hs -o dist/build/Data/Maybe.o
 -ohi dist/build/Data/Maybe.hi
dist/build/GHC/Base.hi
Dict fun GHC.Base.$f9:
  Interface file inconsistency:
home-package module `base:GHC.Base' is needed,
but is not listed in the dependencies of the interfaces directly
imported by the module being compiled
Cannot continue after interface file error
ghc: 20271680 bytes, 2 GCs, 132152/132152 avg/max bytes residency (1
samples), 31M in use, 0.01 INIT (0.02 elapsed), 0.06 MUT (0.14
elapsed), 0.03 GC (0.04 elapsed) :ghc

I'm not sure what to do from here - showSDocDebug comes from
Outputable, which was already imported by InstEnv, so it didn't seem
like I should have to change anything in the build..

 /g

-- 
I am in here
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Instrumenting overlapping instances

2008-10-27 Thread J. Garrett Morris
Hi,

This is neat - but not quite what I was hoping for.  My intended use
was to build a number of packages and produce a listing of all
overlapping instances, without knowing in advance which classes might
contain overlap.  This is why I was hoping to instrument GHC instead
of using the existing tools like GHCi or my eyes.

Thanks though!

 /g

On Mon, Oct 20, 2008 at 4:18 PM, Claus Reinke [EMAIL PROTECTED] wrote:
 I'm currently studying the use of overlapping instances, and I was
 hoping to instrument GHC to produce some variety of list of instances
 that overlapped.  I haven't done any GHC hacking so far, so I'm not
 entirely familiar with the code base.  Does anyone have any guidance
 on which modules I should likely need to modify?

 None?-) Loading this

   {-# LANGUAGE FlexibleInstances #-}
   class C a
   instance C a
   instance C [a]
   instance C [()]
   instance C [Bool]
   instance C Bool

 into ghci 6.8.3, we can play with various types and get ghci to list
 overlaps
 that might match those types. Of course, there are some oddities. Also, the
 behaviour will differ slightly if we actually enable OverlappingInstances.
 But
 it should get you started.

 Claus

 *Main (undefined :: C a = a)
 *** Exception: Prelude.undefined
 *Main (undefined :: C a = a) :: b

 interactive:1:1:
   Overlapping instances for C b
 arising from instantiating a type signature at interactive:1:1-21
   Matching instances:
 instance C a
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:3:0-11
 instance C Bool
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:7:0-14
 instance C [Bool]
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:6:0-16
 instance C [()]
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:5:0-14
 instance C [a]
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:4:0-13
   (The choice depends on the instantiation of `b'
To pick the first instance above, use -fallow-incoherent-instances
when compiling the other instance declarations)
   In the expression: (undefined :: (C a) = a) :: b
   In the definition of `it': it = (undefined :: (C a) = a) :: b
 *Main (undefined :: C a = a) :: Bool

 interactive:1:1:
   Overlapping instances for C Bool
 arising from instantiating a type signature at interactive:1:1-21
   Matching instances:
 instance C a
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:3:0-11
 instance C Bool
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:7:0-14
   In the expression: (undefined :: (C a) = a) :: Bool
   In the definition of `it': it = (undefined :: (C a) = a) :: Bool
 *Main (undefined :: C a = a) :: [b]

 interactive:1:1:
   Overlapping instances for C [b]
 arising from instantiating a type signature at interactive:1:1-21
   Matching instances:
 instance C a
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:3:0-11
 instance C [a]
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:4:0-13
 instance C [Bool]
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:6:0-16
 instance C [()]
   -- Defined at C:/Documents and Settings/cr3/Desktop/Overlap.hs:5:0-14
   In the expression: (undefined :: (C a) = a) :: [b]
   In the definition of `it': it = (undefined :: (C a) = a) :: [b]

 Claus





-- 
I am in here
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Instrumenting overlapping instances

2008-10-20 Thread J. Garrett Morris
Hello,

I'm currently studying the use of overlapping instances, and I was
hoping to instrument GHC to produce some variety of list of instances
that overlapped.  I haven't done any GHC hacking so far, so I'm not
entirely familiar with the code base.  Does anyone have any guidance
on which modules I should likely need to modify?

Thanks,

 /g
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


GHC 6.10 confusion

2008-10-17 Thread J. Garrett Morris
Hello everyone,

I've been attempting to build darcs under ghc-6.10.0.20080920.
Currently, I'm getting the following error:

ghc failed with:  D:\Programs32\GHC\ghc-6.10.0.20080920\bin/windres:
CreateProcess (null): No error

Does anyone recognize this?  Any pointers for where I should be looking?

This is on Vista 64-bit SP1.

 /g

-- 
I am in here
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: GHC 6.10 confusion

2008-10-17 Thread J. Garrett Morris
My hero!  This resolved my problem.

 /g

On Fri, Oct 17, 2008 at 8:38 AM, Mitchell, Neil
[EMAIL PROTECTED] wrote:
 Hi

 See: http://hackage.haskell.org/trac/ghc/ticket/2585

 The solution is to grab a version of GHC 6.8 and copy its windres.exe
 into the GHC 6.10 bin directory.

 This will be fixed before release.

 Thanks

 Neil



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf
 Of J. Garrett Morris
 Sent: 17 October 2008 4:21 pm
 To: GHC users
 Subject: GHC 6.10 confusion

 Hello everyone,

 I've been attempting to build darcs under ghc-6.10.0.20080920.
 Currently, I'm getting the following error:

 ghc failed with:  D:\Programs32\GHC\ghc-6.10.0.20080920\bin/windres:
 CreateProcess (null): No error

 Does anyone recognize this?  Any pointers for where I should
 be looking?

 This is on Vista 64-bit SP1.

  /g

 --
 I am in here
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



 ==
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:

 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
 ==





-- 
I am in here
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Exposed module still hidden, why?

2007-11-20 Thread J. Garrett Morris
As I understand it, Cabal hides all packages by default.  If a package
is not in your dependencies, it won't be available to the build, no
matter the status in ghc-pkg.

(Incidentally, this had neat consequences in the past, since it means
that packages being hidden in ghc-pkg also does not make them
unavailable to cabal.  I spent some time at a previous employer
attempt to debug a build failure where it turned out that the
developer experiencing the failure had not pulled all the changes.  In
particular, we had packages A, B, and C, where C depended on A and B,
and B depended on A.  The developer had pulled updates to A and C, but
not B.  A built and installed a new version, hiding B (which was based
on an old version).  The developer the build C.  Cabal started with
everything hidden, then revealed A and B as specified by C's cabal
file, and the predictable build failures resulted.  I have not tried
this with GHC/Cabal builds since 6.4.2, so this is probably no longer
possible.)

 /g

On Nov 20, 2007 2:18 PM, Greg Fitzgerald [EMAIL PROTECTED] wrote:
 Using GHC 6.8.1 on Windows XP, after having used ghc-pkg to expose
 'directory-1.0.0.0', I am getting an error when I build haddock that says
 the package is hidden.  When I type ghc-pkg list, the package is not in
 parenthesis.  Typing ghc -v says that it is using the file from
 C:\ghc\ghc- 6.8.1\package.conf.  That package.conf file has the 'exposed'
 set to True for that file.  Why does GHC still think the package is hidden?

 ...\haddock-0.8runhaskell Setup.lhs configure
 Configuring haddock-0.8...

 ...\haddock-0.8runhaskell Setup.lhs build
 Preprocessing executables for haddock-0.8...
 shift/reduce conflicts:  5
 Building haddock-0.8...

 src/Main.hs:49:7:
 Could not find module `System.Directory':
   it is a member of package directory-1.0.0.0, which is hidden

 ...\haddock-0.8ghc-pkg list
 C:/ghc/ghc-6.8.1\package.conf:
 Cabal-1.2.2.0, HUnit-1.2.0.0, OpenGL-2.2.1.1, QuickCheck-1.1.0.0,
 Win32-2.1.0.0, array-0.1.0.0, base-3.0.0.0, bytestring-0.9.0.1,
 cgi-3001.1.5.1, containers-0.1.0.0, directory-1.0.0.0, fgl-5.4.1.1,
 filepath-1.1.0.0, (ghc-6.8.1), haskell-src-1.0.1.1,
 haskell98-1.0.1.0 , hpc-0.5.0.0, html-1.0.1.1, mtl-1.1.0.0,
 network-2.1.0.0, old-locale-1.0.0.0, old-time-1.0.0.0,
 packedstring-0.1.0.0, parallel-1.0.0.0, parsec-2.1.0.0,
 pretty-1.0.0.0, process-1.0.0.0, random-1.0.0.0 ,
 regex-base-0.72.0.1, regex-compat-0.71.0.1, regex-posix-0.72.0.1,
 rts-1.0, stm-2.1.1.0, template-haskell-2.2.0.0, time-1.1.2.0,
 xhtml-3000.0.2.1

 Thanks,
 Greg

 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users





-- 
The man who'd introduced them didn't much like either of them, though
he acted as if he did, anxious as he was to preserve good relations at
all times. One never knew, after all, now did one now did one now did
one.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


getMBlocks: VirtualAlloc MEM_RESERVE 1 blocks failed

2007-09-11 Thread J. Garrett Morris
Hello everyone,

I've been running into the following error:

Reproduction.exe: getMBlocks: VirtualAlloc MEM_RESERVE 1 blocks
failed: Not enough storage is available to process this command.

The confusing part to me is that when the error occurs, Task Manager
reports that the process is using around 100K of memory, while I know
that the machine has at least 2GB available.

Reproduction case is attached.  This runs against the Netflix prize
training set, which is large enough that I haven't attached it.  At
the time that the error occurs, it's processed on the order of 15,500
files.  Is it possible there's some other resource that I'm exhausting
without realizing it?

The compiler command line is:
ghc --make -O2 -threaded -hidir obj -odir obj -o Reproduction Reproduction.hs

 /g
module Main where

import Control.Arrow
import Control.Monad (foldM)
import Control.Parallel.Strategies (rnf)
import qualified Data.ByteString.Char8 as B 
import qualified Data.IntMap as M
import Data.List (foldl')
import System.Directory
import System.Environment (getArgs)
import System.IO (stderr, hPutStr)

loadMovie :: String - IO (Maybe (Int, M.IntMap Int))
loadMovie path = 
do text - B.readFile path 
   return $
  case B.lines text of
[] - Nothing
(s:ss) - 
let Just (movie, _) = B.readInt s
in Just (movie, ratings ss)
where addInt list string = (movie, rating) : list
  where Just (movie, rest) = B.readInt string
Just (rating, _)   = B.readInt (B.tail rest) 
  ratings ss = rnf l `seq` M.fromList l
  where l = foldl' addInt [] ss

load :: String - IO (M.IntMap (M.IntMap Int))
load path =
do files - getDirectoryContents path
   case files of 
 [] - return M.empty
 _  - foldM addMovie M.empty files
where addMovie :: M.IntMap (M.IntMap Int) - String - IO (M.IntMap (M.IntMap Int))
  addMovie map file =
  if file == . || file == ..
  then return map
  else do Just (movie, ratings) - loadMovie (path ++ \\ ++  file)
  hPutStr stderr .
  return $ M.insert movie ratings map 

averages path =
do movies - load path
   let averages = map (\(movie, ratings) - (movie, M.fold (\rating (sum, count) - (sum + rating, count + 1)) (0,0) ratings)) (M.toList movies)
   averages' = map (second (\(sum, length) - fromIntegral sum / fromIntegral length)) averages
   mapM_ print averages'
  

main = 
do args - getArgs
   averages (args !! 0)___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Type wildcards, was: Re: [Haskell] GHC Error question

2006-12-07 Thread J. Garrett Morris

On 12/7/06, Lennart Augustsson [EMAIL PROTECTED] wrote:

Speaking of wishlist, I'd also like to see context synonyms, e.g.,
context C a = (Ord a, Num a)


This is equivalent to John Meacham's class alias proposal, right?
(http://repetae.net/john/recent/out/classalias.html)

/g

--
It is myself I have never met, whose face is pasted on the underside of my mind.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: runghc -fglasgow-exts issues

2006-12-01 Thread J. Garrett Morris

This is not the exact answer to your question, but if the first line
of your .hs file is

{-# OPTIONS_GHC -fglasgow-exts #-}

then GHC extensions will be enabled within the file, whether compiled,
loaded in GHCi, or run with runghc.  Other compilers should ignore the
pragma (unlike the older {# OPTIONS #-})

/g

On 12/1/06, Vyacheslav Akhmechet [EMAIL PROTECTED] wrote:

I need to pass -fglasgow-exts to runghc. It appears that if the first
flag to runghc is -f, it treats it as a path to GHC itself. So, I
cannot do the following:

 runghc -fglasgow-exts Test.hs

because runghc failes (it says it can't find glasgow-exts). However if
I do this:

 runghc -fc:/ghc/bin/ghc.exe -fglasgow-exts Test.hs

it works. Is this the expected behavior? I really don't want to pass
full path to GHC in order to simply specify -fglasgow-exts.  I could
fool runghc by doing this:

 runghc -v -fc:/ghc/bin/ghc.exe -fglasgow-exts Test.hs

and it'll work since the first argument isn't -f, but I really don't
want to do this (if I have to, what's a good argument that does
nothing?).

Thanks,
 - Slava.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users




--
It is myself I have never met, whose face is pasted on the underside of my mind.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: FW: [GHC] #916: windows installer should play nice with other Haskell tools

2006-09-28 Thread J. Garrett Morris

On 9/28/06, Neil Mitchell [EMAIL PROTECTED] wrote:

I think me and Claus came to an agreement, and I have documented it in
a wiki page at:
http://haskell.org/haskellwiki/Installers

Anything there that is either unclear or controversial?


While this may not be true for other interpreted files, the convention
that seems to have been established for batch files, HTML files, etc
is that the Open (default) menu item runs (or displays) the given
file, and that there are non-default Edit options for each possible
editor (e.g., Notepad, Dreamweaver, etc.).  Adopting this convention,
each interpreter would add Open in interpreter to the context
menu, providing the user an option to make this the default behavior,
and would, if necessary, also install an Edit with interpreter
option.  I believe adopting this approach would not only preserve
similarity with existing behavior, but would be more internally
consistent.  Presented with a list of Open in interpreter options
and a default also called Open, I would expect them to have similar
behavior.  Editing is not (to me) similar to running.

/g
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: FW: [GHC] #916: windows installer should play nice with other Haskell tools

2006-09-28 Thread J. Garrett Morris

On 9/28/06, Neil Mitchell [EMAIL PROTECTED] wrote:

The advantage of having one Edit command which is the default is that
its a single unambiguous default, and doesn't result in things
stealing from each other etc. No one has to decide if they are a GHC
user or a Hugs user, then can all just be happy. I think its possible
to make an Edit command the default, would that make you happier? i.e.
no open, but by default you edit.


That seems like a decent compromise from here.  Since I personally set
my edit command to use Emacs (via gnuclientw), I assume installers
will ask before clobbering it?

/g

--
It is myself I have never met, whose face is pasted on the underside of my mind.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


6.6 candidate

2006-09-05 Thread J. Garrett Morris

Hello,

I successfully downloaded and installed ghc-6.5.20060901 on Windows XP
(SP2 etc.).  However, when attempting to build fps-0.8, I received a
large number of errors stemming from gcc being unable to find Stg.h or
HsBase.h.  As far as I could tell using -v, gcc is still being passed
the old path to the include files (ghc-dir\include, perhaps) whereas
said files were actually located in
ghc-dir\lib\i386-unknown-mingw32\include.  Moving the files from the
new location to the old solved the compilation problem.

Was this a problem in the distributed build, or did I do something
wrong when I was installing it?

Thanks.

/g

--
It is myself I have never met, whose face is pasted on the underside of my mind.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Help tracking down a bug

2006-05-19 Thread J. Garrett Morris

Hello,

For the past couple of weeks, since downloading 6.4.2, I've been
running into occasion panics:

ghc-6.4.2: panic! (the `impossible' happened, GHC version 6.4.2):
   tcIfaceTyVar a{tv}

Consistently, changing certain files causes this error.  Which files
in particular cause it vary by machine - unfortunately, I don't have a
very wide variety of machines to test it on.

My concern is that this is occuring in about 5000 lines of proprietary
code, and I'm not sure where to start in trying to create a repro
case.  Any guidance?

Thanks.
/g
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


GADT question

2005-10-10 Thread J. Garrett Morris
Hello,

I've been attempting to use GADTs to create a small domain specific
language, and I'm running into an odd problem.  Adding one case to the
example at the beginning of the Wobbly types paper:

data Term :: * - *
where Lit :: a - Term a
  Inc :: Term Int - Term Int
  IsZ :: Num a = Term a - Term Bool
  Div :: Fractional a = Term a - Term a - Term a
  If :: Term Bool - Term a - Term a - Term a

and extending the eval function accordingly:

eval :: Term a - a
eval (Lit i) = i
eval (Inc t) = eval t + 1
eval (IsZ t) = eval t == 0
eval (Div t u) = eval t / eval u
eval (If cond cons alt) = if eval cond then eval cons else eval alt

I get an error No instance for (Fractional a) arising from the use of
'/'  This seems odd to me, since Div is constrained to have
fractional arguments.  Is there something obvious I'm missing?

Thanks,

 /g
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Simple GADTs Question

2005-10-06 Thread J. Garrett Morris
Hello,

I'm attempting to use GADTs for the first time, and I'm running into
an (I think) odd error.  My file includes:

data DFExpr :: * - *
where Deriv :: (Num t) = t - Deriv Int (DFExpr t) (DFExpr t)
  (:+:) :: (Num t) = DFExpr t - DFExpr t - DFExpr t
-- and so forth,
  DFFeat :: FExpr t

and I'm getting an error Not in scope: type constructor or class
`Deriv'.  I've got -fglasgow-exts in the options - what else should I
be doing?

 /g
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users