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).

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)

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

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

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

[Haskell] Fwd: PhD studentship on ABCD

2013-11-20 Thread J. Garrett Morris
Apologies for multiple copies. -- Forwarded message -- From: Philip Wadler wad...@inf.ed.ac.uk Date: Wed, Nov 20, 2013 at 12:02 PM Subject: PhD studentship on ABCD To: types-annou...@lists.seas.upenn.edu types-annou...@lists.seas.upenn.edu, lfcs-inter...@inf.ed.ac.uk,

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

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

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 ...

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

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

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

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,

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

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

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

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

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

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

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  

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

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.

Re: [Haskell-cafe] Stupid question #374: why is MaybeT not in the standard library?

2008-12-22 Thread J. Garrett Morris
On Mon, Dec 22, 2008 at 2:31 PM, Brian Hurt bh...@spnz.org wrote: But I'm wondering why it's not in the standard library. The standards committee just hasn't gotten around to it yet? Or was there some discussion of this in the past on some (public) maillist, that my admittedly shallow

Re: [Haskell-cafe] Time for a new logo?

2008-12-14 Thread J. Garrett Morris
On Sun, Dec 14, 2008 at 2:38 PM, Don Stewart d...@galois.com wrote: ketil: Nice. For some more hubris, replace 'A' with 'The'. I had the very same thought :) It certainly wouldn't do to let, say, the existence of Concurrent Clean get in the way of our self-promotion. /g -- I am in here

Re: [Haskell-cafe] Instances that shouldn't overlap

2008-11-26 Thread J. Garrett Morris
On Wed, Nov 26, 2008 at 1:54 PM, Miguel Mitrofanov [EMAIL PROTECTED] wrote: Maybe it'd be more intuitive if written backwards: AppEq f a = (Applicative f, Eq a) or even AppEq f a = (Applicative f, Eq a) The first is good, the second isn't. The first says the right thing: if you can prove

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

Re: [Haskell-cafe] Re: Type question in instance of a class

2008-11-18 Thread J. Garrett Morris
On Tue, Nov 18, 2008 at 1:38 AM, Reiner Pope [EMAIL PROTECTED] wrote: ATs are Associated Types, aka Type Families. They can be found in the GHC 6.10 manual here: http://haskell.org/ghc/docs/6.10.1/html/users_guide/type-families.html As a starting point, you might want to try something like:

Re: [Haskell-cafe] Re: Type question in instance of a class

2008-11-17 Thread J. Garrett Morris
On Mon, Nov 17, 2008 at 10:38 AM, Maurí­cio [EMAIL PROTECTED] wrote: newtype ComplexWithDouble = ComplexWithDouble (ComplexNumber Double) deriving ... Perhaps you want something like: class Complex r c | c - r where makeComplex :: r - r - c realPart :: c - r imagPart

Re: [Haskell-cafe] Type question in instance of a class

2008-11-16 Thread J. Garrett Morris
On Sun, Nov 16, 2008 at 1:32 PM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, Why is this wrong? class MyClass r where function :: r - s data MyData u = MyData u instance MyClass (MyData v) where function (MyData a) = a GHC says that the type of the result of 'function' is both

Re: [Haskell-cafe] getLine and ^C on Windows

2008-11-13 Thread J. Garrett Morris
I've had the same experience with runghc in GHC 6.10.1 on Vista. /g 2008/11/12 Lyle Kopnicky [EMAIL PROTECTED]: Hi folks, I'm using System.IO.getLine to read input in my program. I've compiled it on Windows Vista with ghc-6.10.1. I've noticed that if I press Ctrl+C while the program is

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

Re: [Haskell-cafe] [Somewhat OT] Speed

2008-10-28 Thread J. Garrett Morris
On Tue, Oct 28, 2008 at 12:31 PM, Andrew Coppin [EMAIL PROTECTED] wrote: This isn't specifically to do with Haskell, but... does anybody have any idea roughly how fast various CPU operations are? Yes: it's architecture dependent. I imagine you'll need to make your questions at least somewhat

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

Re: [Haskell-cafe] Crash!

2008-10-23 Thread J. Garrett Morris
On Thu, Oct 23, 2008 at 11:00 AM, Andrew Coppin [EMAIL PROTECTED] wrote: I was under the impression that this is impossible, so I'm now slightly worried. I'm not sure why you'd think that: import Foreign fail :: IO Int fail = peek nullPtr main = fail = print /g -- I am in here

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

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?

Re: GHC 6.10 confusion

2008-10-17 Thread J. Garrett Morris
. 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

Re: [Haskell-cafe] Foreign.Marshal.Error.void

2008-10-14 Thread J. Garrett Morris
mapM and mapM_ have different complexity - I don't know if the compiler would be smart enough to infer mapM_ style behavior for (void . mapM). /g On Tue, Oct 14, 2008 at 10:52 AM, Mauricio [EMAIL PROTECTED] wrote: Hi, Wouldn't it be nice if we had something like 'void' in

[Haskell-cafe] Re: Improving MTL instances (was: Overlapping/Incoherent instances)

2008-10-13 Thread J. Garrett Morris
On Mon, Oct 13, 2008 at 12:29 AM, Ryan Ingram [EMAIL PROTECTED] wrote: Of course, the point of this message isn't just to complain. The overlap implementation was abhorrent and it *is* better now than it was before. I'm curious what you find abhorrent about the overlap implementation that was

Re: [Haskell-cafe] Overlapping/Incoherent instances

2008-10-12 Thread J. Garrett Morris
On Sun, Oct 12, 2008 at 2:12 PM, Don Stewart [EMAIL PROTECTED] wrote: Though I note mtl doesn't actually list OverlappingInstances in its .cabal file, Indeed - MTL seems to have been rewritten at some point in the past to prefer exhaustive enumeration to overlap. Thank you for the other

Re: [Haskell-cafe] Haskell PNG Writer

2008-05-09 Thread J. Garrett Morris
As long as you don't mind producing two-color images, http://haskell.org/haskellwiki/Library/PNG is an option. I found it very easy to extend it to eight-bit grayscale - I didn't need fullcolor images. /g On Sat, May 3, 2008 at 11:12 PM, Nahuel Rullo [EMAIL PROTECTED] wrote: Hi list, i am new

Re: [Haskell-cafe] Tim Sweeney (the gamer)

2008-01-09 Thread J. Garrett Morris
I imagine you can get in touch with him through Epic (www.epicgames.com) if you can't find another way to contact him. /g On Jan 9, 2008 4:21 PM, Galchin Vasili [EMAIL PROTECTED] wrote: Hello, I have been reading with great interested Tim Sweeney's slides on the Next Generation

Re: [Haskell-cafe] A small question

2007-11-21 Thread J. Garrett Morris
On Nov 21, 2007 5:16 AM, Jeremy O'Donoghue [EMAIL PROTECTED] wrote: Not just Windows Vista. Applications and DLLs compiled with Visual Studio 2005 (Express or full version) seem to need it to run on XP as well. I believe the dependency here is version 8 of the Visual C RTL. Applications that

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

Re: [Haskell-cafe] A small question

2007-11-15 Thread J. Garrett Morris
http://msdn2.microsoft.com/en-us/library/1w45z383(vs.71).aspx I believe. /g On Nov 15, 2007 12:56 PM, Andrew Coppin [EMAIL PROTECTED] wrote: I notice that in GHC 6.8.1, if I compile a runnably program, as well as generating foo.exe, GHC now also generates a file foo.exe.manifest, which

[Haskell-cafe] Memory Leak Help

2007-11-11 Thread J. Garrett Morris
Hello, I have code which seems to contain a memory leak, but I'm not sure where it is or what's causing it. Any help would be greatly appreciated: The code is: data Ratings = Ratings { movieCount :: Int , movieLookup :: IOUArray Int Word32 ,

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-13 Thread J. Garrett Morris
I believe that rnf from the Control.Parallel.Strategies library shipped with GHC 6.6.1 is equivalent to deepSeq, as in: x `deepSeq` yis equivalent to rnf x `seq` y Isn't it? /g On 9/12/07, Peter Verswyvelen [EMAIL PROTECTED] wrote: Thanks for all the info. It's really good news that

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

Re: Re[2]: [Haskell-cafe] Is this haskelly enough?

2007-07-18 Thread J. Garrett Morris
This is probably just me, but I've always mentally separated the list monad (representing choice) from operations on ordered sets implemented by lists (which don't always have to represent choice). In this case, since the remainder of the code wasn't monadic, I find it much easier to understand

Re: [Haskell-cafe] Re: Practise fingerspelling with Haskell! (Code cleanup request)

2007-07-18 Thread J. Garrett Morris
On 7/18/07, Dougal Stanton [EMAIL PROTECTED] wrote: I worked out that [ (a,b) | a - as, b - bs ] must be equivalent to comp = concatMap (\x - map ((,) x) ys) xs but I can't really say how conditions like a /= b get slotted in to that style. Is there a reference for that? As I understand it,

Re: [Haskell-cafe] Is this haskelly enough?

2007-07-17 Thread J. Garrett Morris
Hi James. I would be tempted to write this a little differently than you did. First, some of the pieces you've written have equivalents in the standard library; there's no harm in rewriting them, but I figured I'd point out that they're there. (Hoogle - haskell.org/hoogle, I believe - can be a

Re: [Haskell-cafe] Is this haskelly enough? -- errm but every answer is wrong(?)

2007-07-17 Thread J. Garrett Morris
On 7/17/07, Anthony Clayden [EMAIL PROTECTED] wrote: 2. The inits . tails approach adds a fault: It introduces a sprinkling of empty sub-sequences. These have sum zero. So in case the input list is all negative numbers ... At least the concatMap inits . tails code that I posted also

Re: [Haskell-cafe] needsaname :: ([a] - Maybe (b, [a])) - (b - [a]) - [a] - [a]

2007-07-06 Thread J. Garrett Morris
morph :: ([a] - Maybe (b,[a])) - (b - [a]) - [a] - [a] Any reason not to call it 'replace'? /g On 7/6/07, Jules Bean [EMAIL PROTECTED] wrote: Hi, Yet another Function looking for a name post. Here's the type: morph :: ([a] - Maybe (b,[a])) - (b - [a]) - [a] - [a] Here, I am calling

Re: [Haskell-cafe] Tools for Haskell and COM

2007-06-27 Thread J. Garrett Morris
Microsoft's Component Object Model. http://en.wikipedia.org/wiki/Component_Object_Model /g On 6/27/07, Andrew Coppin [EMAIL PROTECTED] wrote: Simon Peyton-Jones wrote: The biggest Haskell/COM project I know of was Krasimir's implementation of Visual Haskell, which was a plug-in for Visual

Re: [Haskell-cafe] Re: Reinvention

2007-06-27 Thread J. Garrett Morris
More generally, that's unfoldr: Prelude :t Data.List.unfoldr Data.List.unfoldr :: (b - Maybe (a, b)) - b - [a] unfoldr represents the end of the unfold explicitly (using Nothing) instead of implicitly (using the empty list). /g On 27 Jun 2007 20:26:56 +0100, Jon Fairbairn [EMAIL PROTECTED]

Re: Re[2]: [Haskell-cafe] Re: Keys and Maps [Was: Re: I just don't get it (data structures and OO)]

2007-06-08 Thread J. Garrett Morris
On 6/8/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: I second that. I particularly like the elimination of ]'s. We certainly need some symbol to separate the map and the key; but we do really need to also mark here be the end of the key? and how (arr ! key ++ data) should be parsed? :)

Re: [Haskell-cafe] Re: nested maybes

2007-02-06 Thread J. Garrett Morris
On 2/6/07, Yitzchak Gale [EMAIL PROTECTED] wrote: J. Garrett Morris wrote: Well, no, but it is at least no worse than apply :: Handle - Attribute a - ContT (StateT Blargh (ErrorT Fzzt IO)) a I find that in general, many functions do not need all of the capabilities. If they do, you can alias

Re: [Haskell-cafe] Re: nested maybes

2007-02-05 Thread J. Garrett Morris
On 2/5/07, Yitzchak Gale [EMAIL PROTECTED] wrote: J. Garrett Morris wrote: First, we'll create a transformed version of the IO monad, Why go to the trouble of creating a new monad? The existing ones are fine. Mainly to keep the type error messages simpler. A project I was working on started

Re: [Haskell-cafe] Re: nested maybes

2007-02-05 Thread J. Garrett Morris
On 2/5/07, Yitzchak Gale [EMAIL PROTECTED] wrote: J. Garrett Morris wrote: Mainly to keep the type error messages simpler. There are two ways to get around that problem: 1. Make your functions polymorphic, using MonadState, MonadError, etc. Each function mentions only the capabilities

Re: [Haskell-cafe] nested maybes

2007-02-04 Thread J. Garrett Morris
Maybe has a Monad instance, so you can write this as follows (untested): exists str wmap = boolFromMaybe exists' where exists' = do x - Map.lookup (sort str) wmap find (== str) (snd x) boolFromMaybe (Just _) = True boolFromMaybe Nothing = False

Re: [Haskell-cafe] nested maybes

2007-02-04 Thread J. Garrett Morris
On 2/4/07, Udo Stenzel [EMAIL PROTECTED] wrote: J. Garrett Morris wrote: Small improvement (Data.Maybe is underappreciated): exists str wmap = isJust exists' where exists' = do x - Map.lookup (sort str) wmap find (== str) (snd x) This is true. Some time

Re: [Haskell-cafe] nested maybes

2007-02-04 Thread J. Garrett Morris
On 2/4/07, Udo Stenzel [EMAIL PROTECTED] wrote: J. Garrett Morris wrote: On 2/4/07, Udo Stenzel [EMAIL PROTECTED] wrote: Well, depends on whether we are allowed to define new combinators. I sometimes use -- Kleisli composition infixl 1 @@ (@@) :: Monad m = (a - m b) - (b - m c) - (a - m c) f

Re: [Haskell-cafe] Re: nested maybes

2007-02-04 Thread J. Garrett Morris
On 2/4/07, Martin Huschenbett [EMAIL PROTECTED] wrote: Hi, I've often got the same pattern with nested Maybes but inside the IO monad (sure this could be every other monad too). Assuming that I've got functions: This is where my favorite part of the mtl steps in: monad transformers. First,

Re: [Haskell-cafe] (a - [b]) vs. [a - b]

2007-02-02 Thread J. Garrett Morris
Uh, apologies. I got confused between reading your post and playing for a while, and answered the wrong question. /g On 2/2/07, J. Garrett Morris [EMAIL PROTECTED] wrote: On 2/2/07, Chad Scherrer [EMAIL PROTECTED] wrote: So in reality, I'm trying to construct something like f :: (a - STM b

Re: [Haskell-cafe] Levels of recursion

2007-02-02 Thread J. Garrett Morris
On 1/31/07, Andrew Wagner [EMAIL PROTECTED] wrote: So, a couple of questions to ponder about this: Is this unique to Haskell, or could the same be said about any functional language? How can we teach this better to newbies? Most of what I see in the tutorials is Higher order functions accept

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-02 Thread J. Garrett Morris
On 1/28/07, Alexy Khrabrov [EMAIL PROTECTED] wrote: How do people stumble on Haskell? My story isn't as interesting as some of these. My first quarter in school, I took a course taught in Scheme. I expressed some dissatisfaction with the lack of types (and, in particular, the collection of

Re: [Haskell-cafe] It matters how Type Synonyms are defined?

2007-02-02 Thread J. Garrett Morris
Agreed. I've written quite a bit of code that way myself. Looking at Iavor's monadLib, though, raised a question: has there been any consider of removing the requirement that the newtype be the last argument? The classes for state monads, etc. are rather backwards as it is, since the

Re: Re[2]: ADT views Re: [Haskell] Views in Haskell

2007-01-31 Thread J. Garrett Morris
On 1/31/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: snip i hope that now my idea is clear Yes - you've reiterated Wadler's original design, with an automatic creation of a type class. Erwig and Peyton-Jones, _Pattern Guards and Transformational Patterns_

Re: [Haskell-cafe] A function for Maybes

2007-01-25 Thread J. Garrett Morris
fmap. e.g.: Prelude fmap ('c':) (Just a) Just ca Prelude fmap ('c':) Nothing Nothing Prelude /g On 1/25/07, John Ky [EMAIL PROTECTED] wrote: Is there a built-in function that already does this? foo :: (a - b) - Maybe a - Maybe b foo f m | isNothing m = Nothing | otherwise = Just (f

Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread J. Garrett Morris
On 1/4/07, brad clawsie [EMAIL PROTECTED] wrote: lets say i have a string s = abcdefg now i have two lists of strings, one a list of patterns to match, and a list of replacement strings: patterns = [a,b] replace = [Z,Y] from which my intent is that a be replaced by Z, b by Y etc now using

Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread J. Garrett Morris
Oops, I seem not to have proofread my message. On 1/4/07, J. Garrett Morris [EMAIL PROTECTED] wrote: On 1/4/07, brad clawsie [EMAIL PROTECTED] wrote: s = abcdefg patterns = [a,b] replacements = [Z,Y] I changed the name here so as not to conflict with the replace function. snip You can

Re: [Haskell-cafe] State separation/combination pattern question

2006-12-23 Thread J. Garrett Morris
On 12/22/06, Reto Kramer [EMAIL PROTECTED] wrote: What I'm really looking for is not so much the chaining of StateT compositions, but rather the isolation of StateA from StateB while they both flow from the search loop into the respective library calls (foo, bar) transparently to the application

[Haskell-cafe] ST and Transformers

2006-12-22 Thread J. Garrett Morris
Hello everyone, I recently found myself attempting to use ST at the base of a stack of transformers, ala: type Test t r = ErrorT String (ST t) r I imagined, given the type of ST, that I would need a run function along the lines of: runTest :: (forall t. Test t r) - Either String r (which

Re: [Haskell-cafe] ST and Transformers

2006-12-22 Thread J. Garrett Morris
Hmm, that was simpler than I had imagined. Thank you both! /g On 12/22/06, Stefan O'Rear [EMAIL PROTECTED] wrote: On Fri, Dec 22, 2006 at 06:44:54PM +0100, Pepe Iborra wrote: Rank-2 types seem to interact badly with (.) and ($), but my type theory educated neuron doesn't know why. I think

Re: [Haskell-cafe] Shrinking the Prelude: The categorical approach

2006-12-20 Thread J. Garrett Morris
On 12/20/06, Diego Navarro [EMAIL PROTECTED] wrote: take map for example, and fmap, I don't think they should be named different (fmap is ugly, not suggestive, and conceptually the same). mplus could be renamed (++) (they are conceptually the same Wouldn't this raise the same problems

Re: [Haskell-cafe] Building the community

2006-12-13 Thread J. Garrett Morris
On 12/13/06, Donald Bruce Stewart [EMAIL PROTECTED] wrote: * Give tips on how to answer questions + Ok. we can put up an article here. Some suggestions: - Solutions with unsafePerformIO should be discouraged (moreso ;) I'd like to at least suggest a slight

Re: [Haskell-cafe] Writing Haskell For Dummies Or At Least For People Who Feel Like Dummies When They See The Word 'Monad'

2006-12-12 Thread J. Garrett Morris
Hello everyone, On 12/12/06, Ketil Malde [EMAIL PROTECTED] wrote: snip Some things took a bit of effort to wrap my head around, but it generally wasn't too hard to get to a level where I could write useful programs. snip * I'm already productive with what I know, so I don't have the direct

Re: [Haskell-cafe] Stratified monads

2006-12-11 Thread J. Garrett Morris
On 12/11/06, Mark T.B. Carroll [EMAIL PROTECTED] wrote: I'm not sure I actually understand them properly yet, but I'm already curious about if anybody's played with them in Haskell, or how useful it would be to do so. Any comments? Haskell implementations of the transformers in Espinosa's

Re: [Haskell-cafe] modelling problem

2006-12-08 Thread J. Garrett Morris
On 12/8/06, Kurt Schelfthout [EMAIL PROTECTED] wrote: Hi Haskell'ers, snip class Activity a c where start :: c - a - Time --start of the activity (this isn't actually dependent on c, I guess) end :: c - a - Time --end of the activity delta :: a - Time - c

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

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread J. Garrett Morris
On 12/7/06, Cat Dancer [EMAIL PROTECTED] wrote: On 12/7/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm sure from a single example I could understand what was going on and elaborate from there. Let's say I want to get a line from the user, and either return an integer or an error string

Re: [Haskell-cafe] Picking out elements of a heterogenous list

2006-12-05 Thread J. Garrett Morris
I generally use the Typeable class for this. In that example, you'd want: class Typeable a = Shape_ a instead of just class Shape_ a and then your filter predicate would look like: isSquare :: Shape - Bool isSquare (Shape s) = typeOf s == typeOf square where square :: Square ; square =

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 {#

Re: [Haskell-cafe] Binary code

2006-11-27 Thread J. Garrett Morris
Hello, First, and forgive me if I'm making unwarranted assumptions, but http://haskell.org/haskellwiki/Homework_help might be useful. Second: div, mod, reverse, and the unfoldr function from Data.List will do what you want. /g On 11/25/06, escafia [EMAIL PROTECTED] wrote: Hi, i've one

Re: [Haskell-cafe] working with lists of couples

2006-11-18 Thread J. Garrett Morris
On 11/17/06, Henning Thielemann [EMAIL PROTECTED] wrote: On Fri, 17 Nov 2006, Clara Zamolo wrote: buildCouples = snd . foldl op (0,[]) where op (v,xs) x = (v+x,xs++[(x,v)]) You could make something like this that doesn't have quadratic-type appends by accumulating functions

Re: Re: [Haskell-cafe] Automatic fixity allocation for symbolic operators

2006-10-14 Thread J. Garrett Morris
On 10/14/06, Nicolas Frisby [EMAIL PROTECTED] wrote: Perhaps the editor could assume a default precedence when the user-defined precedence is not yet available. Preferably, the editor would also somehow yell at the user to indicate that it is making such an assumption. Perhaps it could even

Re: [Haskell-cafe] Mis-understanding something in Haskell interpretation

2006-10-03 Thread J. Garrett Morris
On 10/3/06, Edward Ing [EMAIL PROTECTED] wrote: The source is below. Side is types as Float. My assumption was that Haskell would know how to convert the Int to a float and all would be well. I am I mistaken somewhere? The problem is with the last line. Yes - Haskell does not automatically

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,

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

Re: [Haskell-cafe] How to round off frational number?

2006-09-08 Thread J. Garrett Morris
I've always used: roundn n f = fromIntegral (round (f * 10 ^ n)) / 10 ^ n I may have missed some bugs or subtleties of floating point numbers, though. /g On 9/8/06, Sara Kenedy [EMAIL PROTECTED] wrote: Hello all, I try to find some functions in Haskell library to deal with numeric such that

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

Re: [Haskell-cafe] beginner's haskell question

2006-08-08 Thread J. Garrett Morris
The ghc flag -fwarn-incomplete-patterns might be what you're looking for. /g On 8/8/06, Jens Theisen [EMAIL PROTECTED] wrote: Hello, as a haskell newbie I'm wondering about the following question. Are there options to popular haskell implementations or other means (haskell lint?) to check

Re: [Haskell-cafe] A program which never crashes (even when a function calls error)

2006-08-01 Thread J. Garrett Morris
On 8/1/06, Stephane Bortzmeyer [EMAIL PROTECTED] wrote: How to do it in Haskell? How can I call functions like Prelude.head while being sure my program won't stop, even if I call head on an empty list (thus calling error)? Try looking at Control.Exception. For example: module Test where

Re: [Haskell-cafe] putStrLn

2006-06-16 Thread J. Garrett Morris
main n = putStrLn (replicate n '*') main n = putStrLn (take n (repeat '*')) main n = sequence (take n (repeat (putStr *))) (but that doesn't have a final new line. The more complicated: main n = sequence (take (n - 1) (repeat (putStr *))) putStrLn * should solve that problem.) /g On

Re: [Haskell-cafe] Separate a string into a list of strings

2006-06-12 Thread J. Garrett Morris
Off the top of my head: separate :: String - [String] separate [] = [] separate s = case break (',' ==) s of (s,[]) - [s] (s,',':s') - s : separate s' _ - error how did we get here? There is at least one cunning rewriting with foldl, I think, but I think this version is clearer. /g

Re: [Haskell-cafe] newbie type signature question

2006-06-10 Thread J. Garrett Morris
On 6/9/06, Brandon Moore [EMAIL PROTECTED] wrote: data DataType m = forall m' . (Monad m') = DataType (TyEq m m') (Char - m' ()) It appears that the more intuitive formulation: data DataType m where DataType :: Monad m = (Char - m ()) - DataType m should work in GHC 6.4 /g

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

Re: [Haskell-cafe] library sort

2006-02-16 Thread J. Garrett Morris
Data.List contains sort :: Ord a = [a] - [a] and sortBy :: (a - a - Ordering) - [a] - [a] I believe they're currently implemented using merge sort, at least in GHC. /g On 2/16/06, Radu Grigore [EMAIL PROTECTED] wrote: Is there a sort function in the libraries that come with GHC (6.4)? My

Re: [Haskell] compares :: Ord a = a - a - Ordering - Ordering

2006-02-14 Thread J. Garrett Morris
On 2/14/06, Ben Rudiak-Gould [EMAIL PROTECTED] wrote: I just realized that the class Ord should have an additional method: class Eq a = Ord a where compares :: a - a - Ordering - Ordering compares x y d = case compare x y of { EQ - d ; o - o } ... This would make writing

Re: [Haskell-cafe] round function

2006-02-12 Thread J. Garrett Morris
I think the function you're looking for is: myRound n places = round (n / fromIntegral factor) * factor where factor = 10 ^ (places - 1) In this case, 10 ^ (places - 1) has integral type (either Int or Integer). I need it to be a fractional type to divide n by it, so I use fromIntegral to

  1   2   >