Re: [GHC] #3115: mark ghc.cabal so that unsuspecting newbies don't try to edit it
#3115: mark ghc.cabal so that unsuspecting newbies don't try to edit it -+-- Reporter: nr|Owner: Type: feature request | Status: new Priority: normal|Milestone: 6.12 branch Component: Build System | Version: 6.11 Severity: minor | Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * difficulty: = Unknown * milestone: = 6.12 branch Comment: let's do this in the new build system. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3115#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #3116: missed optimisation opportunity with lazy ByteStrings
#3116: missed optimisation opportunity with lazy ByteStrings -+-- Reporter: duncan| Owner: Type: bug | Status: new Priority: normal| Component: Compiler Version: 6.10.1| Severity: normal Keywords:| Testcase: Os: Unknown/Multiple | Architecture: Unknown/Multiple -+-- With strict `ByteString` an a simple tail recursive iteration pattern we get perfect code. First the definitions: {{{ data ByteString = BS {-# UNPACK #-} !(ForeignPtr Word8) -- payload {-# UNPACK #-} !Int -- offset {-# UNPACK #-} !Int -- length null :: ByteString - Bool null (BS _ _ l) = l = 0 tail :: ByteString - ByteString tail (BS p s l) | l = 0 = error ByteString.tail: empty ByteString | otherwise = BS p (s+1) (l-1) }}} Now a trivial iteration pattern: {{{ length :: ByteString - Int length = go 0 where go !n bs | null bs= n | otherwise = go (n+1) (tail bs) }}} Perfect core code (edited for clarity): {{{ go :: Int# - Addr# - ForeignPtrContents - Int# - Int# - Int# go = \n p fpc o l - case l =# 0 of False - go (n +# 1) p fpc (o +# 1) (l -# 1) True - n length :: ByteString - GHC.Base.Int length = \bs - case bs of BS p fpc 0 l - case go 0 p fpc 0 l of n - I# n }}} This worked because strict `ByteString` is a single constructor data type which allows it to be unpacked into separate parameters in the recursive call. Now, lets try the same with lazy `ByteStrings`: {{{ data ByteString = Empty | Chunk {-# UNPACK #-} !StrictBS.ByteString ByteString }}} This of course has two constructors. It's built for call-pattern specialisation. Now the ops: {{{ null :: ByteString - Bool null Empty = True null _ = False tail :: ByteString - ByteString tail Empty = error empty tail tail (Chunk (S.BS fp s 1) cs) = cs tail (Chunk (S.BS fp s l) cs) = Chunk (S.BS fp (s+1) (l-1)) cs }}} We can use the exact same code for tail, but now for the lazy `ByteString` type: {{{ length :: ByteString - Int length = go 0 where go !n bs | null bs= n | otherwise = go (n+1) (tail bs) }}} But, oh noes!! The optimisation does not work: {{{ go :: Int# - ByteString - Int# go = \n bs - case bs of Empty - n Chunk p fpc o l bs' - go (n +# 1) (case l of 1 - bs' _ - Chunk p fpc (o +# 1) (l -# 1) bs') length :: ByteString - Int length = \bs - case go 0 bs of n - I# n }}} However this is not because call pattern specialisation didn't do what we wanted. We know this for several reasons. One, if we remove the case {{{ tail (Chunk (S.BS fp s 1) cs) = cs }}} then call pattern specialisation works and the code ends up as a perfect loop. Of course we need that case for correctness. Also, if we change the definition of lazy `ByteString` to be a single constructor and represent the end by an empty chunk then we still get essentially the same code. Also, if we use `uncons` instead of `null` and `tail` then we effectively perform by hand the missing optimisation transformation and get perfect code (and call-pattern specialisation happens exactly as expected). {{{ length :: ByteString - Int length = go 0 where go !n bs = case uncons bs of Nothing- n Just (_, bs') - go (n+1) bs' uncons :: ByteString - Maybe (Word8, ByteString) uncons Empty = Nothing uncons (Chunk c cs) | StrictBS.length c == 1 = Just (S.unsafeHead c, cs) | otherwise = Just (S.unsafeHead c, Chunk (S.unsafeTail c) cs) }}} This version with `uncons` gives us perfect code: {{{ go_chunk :: ByteString - Int# - Int# - ForeignPtrContents - Addr# - Int# - Int# go_chunk = \bs' l o fpc p n - case l of 1 - go (n +# 1) bs' _ - go_chunk bs' (l -# 1) (o +# 1) fpc p (n +# 1) go :: Int# - ByteString - Int# go = \n bs - case bs of Empty - n Chunk p fpc o l bs' - case l of 1 - go (n +# 1) bs' _ - go_chunk bs' (l -# 1) (o +# 1) fpc p (n +# 1) length :: ByteString - Int length = \bs - case go 0 bs of n - I# n }}} and we can see the specialisation rule that ghc invented for us: {{{ forall bs l o fpc p n. go n (Chunk p fpc o l bs) = go_chunk bs l o fpc p n }}} Aside: looks like there's an extra/missing reverse in there somewhere. The problem with the `head` / `tail` version is that the following transformation is never performed and so the opportunity for call pattern specialisation (or even simple worker/wrapper
[GHC] #3119: Make ghc-6.10 use a non-executable stack (by bumping libffi)
#3119: Make ghc-6.10 use a non-executable stack (by bumping libffi) +--- Reporter: kolmodin | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 6.10.1 | Severity: normal Keywords: | Testcase: Os: Linux| Architecture: Unknown/Multiple +--- Attached patch: {{{ Mon Mar 23 08:08:32 CET 2009 Lennart Kolmodin kolmo...@gentoo.org * Replace libffi 3.0.4 with libffi 3.0.8 Use the latest version of libffi, which compiles with a non-executable stack. libffi 3.0.4 was the single piece of ghc using the executable stack, forcing the whole toolchain to use executable stacks (including all executables it compiled). }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3119 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3119: Make ghc-6.10 use a non-executable stack (by bumping libffi)
#3119: Make ghc-6.10 use a non-executable stack (by bumping libffi) -+-- Reporter: kolmodin | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler |Version: 6.10.1 Severity: normal | Resolution: Keywords: | Testcase: Os: Linux| Architecture: Unknown/Multiple -+-- Comment (by kolmodin): Due to attachment size limitations, I've put the patch here: http://haskell.org/~kolmodin/replace-libffi-3_0_4-with-libffi-3_0_8.dpatch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3119#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Loading plugin with ghc api
Hi, I would like to use the API for ghc, so that a running program can load a module (Foo.o) and use a function defined in that module. From the documentation available, it seems like thatś possible, but I can´t figure out how to do it. There is an example on the wiki, but the explanation just says the code is equivalent to ghc --make. That example does indeed work, but there is no hint as to whether the running program can then access anything defined in the module it has just loaded. Is there any available documentation on how to load a plugin, or any working example somewhere? Thanks in advance, John O´Donnell ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Problem with a second installed version of the syb package
Hello Ian, 2009/3/21 Ian Lynagh ig...@earth.li On Fri, Mar 20, 2009 at 09:33:07AM +0100, José Pedro Magalhães wrote: Bad interface file: C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1\Data\Generics.hi Something is amiss; requested module syb:Data.Generics differs from name found in the interface file syb-0.2.0.0:Data.Generics Failed, modules loaded: none. What is the problem here? What does ghc --show-iface C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1\Data\Generics.hi say? I'm sorry, I reported the error as ran from ghc-6.10.1. Running it with ghc-6.10.2-rc1 I get the error Bad interface file: C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1.20090314\Data\Generics.hi Something is amiss; requested module syb:Data.Generics differs from name found in the interface file syb-0.2.0.0:Data.Generics Failed, modules loaded: none. ghc --show-iface C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1.20090314\Data\Generics.hi says: Magic: Wanted 129742, got129742 Version: Wanted [6, 1, 0, 1, 2, 0, 0, 9, 0, 3, 1, 4], got[6, 1, 0, 1, 2, 0, 0, 9, 0, 3, 1, 4] Way: Wanted [], got[] interface syb-0.2.0.0:Data.Generics 610120090314 interface hash: 2f252bc190bffcb63bc93af0a7864f85 ABI hash: a2784ce2c50f029ab89be2567641765b export-list hash: 9f48270b3bb91438449202f71d1f8386 orphan hash: 693e9af84d3dfcc71e640e005bdc5e2e where export syb-0.2.0.0:Data.Generics.Aliases Generic Generic'|{Generic' Generic' unG eneric'} GenericB GenericM GenericM'|{GM GenericM' unGM} GenericQ GenericQ'|{GQ GenericQ' unGQ} GenericR GenericT GenericT'|{GT GenericT' unGT} choiceMp choiceQ ext0 ext1M ext1Q ext1R ext1T extB extM extMp extQ extR extT mkM mkMp mkQ mkR mk T orElse recoverMp recoverQ export syb-0.2.0.0:Data.Generics.Schemes everything everywhere everywhere' every whereBut everywhereM gcount gdepth gfindtype glength gnodecount gsize gtypecount listify something somewhere synthesize export syb-0.2.0.0:Data.Generics.Text gread gshow export syb-0.2.0.0:Data.Generics.Twins geq gfoldlAccum gmapAccumM gmapAccumQ gma pAccumQl gmapAccumQr gmapAccumT gzip gzipWithM gzipWithQ gzipWithT export ghc-prim:GHC.Generics :*:|{:*: :*:} :+:{Inl Inr} Unit|{Unit Unit} export base:Data.Data ConIndex Constr ConstrRep|{AlgConstr ConstrRep FloatConstr IntConstr StringConstr} Data{dataCast1 dataCast2 dataTypeOf gfoldl gmapM gmapMo gmapMp gmapQ gmapQi gmapQl gmapQr gmapT gunfold toConstr} DataRep|{AlgRep DataR ep FloatRep IntRep NoRep StringRep} DataType Fixity{Infix Prefix} constrFields c onstrFixity constrIndex constrRep constrType dataTypeConstrs dataTypeName dataTy peRep fromConstr fromConstrB fromConstrM indexConstr isAlgType isNorepType maxCo nstrIndex mkConstr mkDataType mkFloatConstr mkFloatType mkIntConstr mkIntType mk NorepType mkStringConstr mkStringType readConstr repConstr showConstr tyconModul e tyconUQname export base:Data.Typeable TyCon TypeRep Typeable{typeOf} Typeable1{typeOf1} Type able2{typeOf2} Typeable3{typeOf3} Typeable4{typeOf4} Typeable5{typeOf5} Typeable 6{typeOf6} Typeable7{typeOf7} cast funResultTy gcast gcast1 gcast2 mkAppTy mkFun Ty mkTyCon mkTyConApp showsTypeRep splitTyConApp tyConString typeOf1Default type Of2Default typeOf3Default typeOf4Default typeOf5Default typeOf6Default typeOfDef ault typeRepArgs typeRepKey typeRepTyCon module dependencies: Data.Generics.Aliases Data.Generics.Instances Data.Generics.Schemes Data.Generics.Text Data.Generics.Twin s package dependencies: ghc-prim integer base orphans: base:Control.Exception.Base syb-0.2.0.0:Data.Generics.Instances base:Data.Tuple base:GHC.Base base:GHC.Float base:GHC.Num family instance modules: import base:Data.Data 2cfe9f6e828ce97d6906225849a7a8df import base:Data.Typeable 00f181e6f8bb32e13d28aad58cee1bf9 import base:GHC.Base 6bdeebb11d04df398eb46d76fd9fedc8 import base:Prelude eac9ca3c0ae6d00a0fc0f1832a247e5e import Data.Generics.Aliases a418fc77a8afb8f63b1349e7e70aae1f exports: 8a3a8813709e82f89b2cbe434cbbeb32 Generic a3d985935013f874e5dce91cd67fc755 Generic' 88e63b7215ef3e70992766168a404331 GenericB b1b3a4bb9264b0843b0aed33984ed6e2 GenericM f1cb29fbd7771577b3ce27762a0176ad GenericM' 270d4c132681a10609808f680f30d2a1 GenericQ acd36022e368af6f81df3e2c9d0655b3 GenericQ' 4fdb300d3293b22b2d81445caaf7f70b GenericR c34610525f7b7b1c9f9866ea45e5f488 GenericT aeab09799011076dc8f091fc77329bb7 GenericT' dfd635d65ef1b252ebb551bd573e2fa4 choiceMp e2a24be4873fbf0985c117f95ef6 choiceQ 402677c976faf710fa20d0dbfaed4338 ext0 188b47185552ece2b9563d279b9f6b11 ext1M 55c90f3b7aa3b30a09235074ccdd8474 ext1Q 0fdb24f93014e9134d27059cab8791f5 ext1R a85ebb59fcd8c1a276968370a82d4696 ext1T bab0e7a30776525b1b9e8e170817874d extB 599378e0cc7f6e3e61782e3f5e819f6e extM 709f4b5d8c98e31a40af3a15507871f9 extMp 5e8fcc4141d141bf89ede5f96286514c extQ 09256ec13d553bb7d533db2aba1e6ddb extR
Re: Loading plugin with ghc api
John O'Donnell wrote: Hi, I would like to use the API for ghc, so that a running program can load a module (Foo.o) and use a function defined in that module. From the documentation available, it seems like thatś possible, but I can´t figure out how to do it. There is an example on the wiki, but the explanation just says the code is equivalent to ghc --make. That example does indeed work, but there is no hint as to whether the running program can then access anything defined in the module it has just loaded. Is there any available documentation on how to load a plugin, or any working example somewhere? Hi John, Once you have your module loaded, you can call dynCompileExpr :: GhcMonad m = String - m Dynamic to compile an arbitrary expression, yielding a Dynamic value that you can cast to the appropriate type. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Loading plugin with ghc api
John O'Donnell wrote: That example does indeed work, but there is no hint as to whether the running program can then access anything defined in the module it has just loaded. I think the running program can only access things *exported* from the module (other functions in that module might even have been optimized away!) Is it okay to require those plugin-modules to export everything you're going to use from them? -Isaac ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
compilation of pattern-matching?
I just noticed that GHC (6.11.20090320) seems to compile both f (a:b:c) = f (a:[]) = f [] = and f [] = f (a:[]) = f (a:b:c) = to something like (looking at Core, but writing source) f x = case x of { [] - ..; (a:t) - case t of { [] -..; (b:c) -..}} That doesn't seem right to me: if I try to give the patterns in the order from frequent to rare, in order to reduce jumps, I don't expect GHC to rearrange things. What is the rationale for this? And where can I read about GHC's pattern match compilation approach in general? Claus ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: compilation of pattern-matching?
How could you match the first case with less than two case constructs? There are two (:) to check for, so I'm not sure what you are complaining about. -- Lennart On Tue, Mar 24, 2009 at 12:16 AM, Claus Reinke claus.rei...@talk21.com wrote: I just noticed that GHC (6.11.20090320) seems to compile both f (a:b:c) = f (a:[]) = f [] = and f [] = f (a:[]) = f (a:b:c) = to something like (looking at Core, but writing source) f x = case x of { [] - ..; (a:t) - case t of { [] -..; (b:c) -..}} That doesn't seem right to me: if I try to give the patterns in the order from frequent to rare, in order to reduce jumps, I don't expect GHC to rearrange things. What is the rationale for this? And where can I read about GHC's pattern match compilation approach in general? Claus ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: compilation of pattern-matching?
How could you match the first case with less than two case constructs? There are two (:) to check for, so I'm not sure what you are complaining about. -- Lennart The number of case constructs is needed, and since case in Core also specifies strict contexts, perhaps there would be no difference, which is why I'm asking about the rationale/documentation. My idea was that case branches correspond to conditional jumps (though the exact correspondence and optimization has been the subject of countless papers). If I loop through a very long list, most of the time the test for (:) will succeed, requiring no jump, while the test for [] will fail, requiring a jump to the alternative branch. So, if GHC's pattern-match compilation is naive, the reordering will introduce 2 jumps into the common case of the loop where none would be needed, right? Claus On Tue, Mar 24, 2009 at 12:16 AM, Claus Reinke claus.rei...@talk21.com wrote: I just noticed that GHC (6.11.20090320) seems to compile both f (a:b:c) = f (a:[]) = f [] = and f [] = f (a:[]) = f (a:b:c) = to something like (looking at Core, but writing source) f x = case x of { [] - ..; (a:t) - case t of { [] -..; (b:c) -..}} That doesn't seem right to me: if I try to give the patterns in the order from frequent to rare, in order to reduce jumps, I don't expect GHC to rearrange things. What is the rationale for this? And where can I read about GHC's pattern match compilation approach in general? Claus ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: compilation of pattern-matching?
On March 23, 2009 19:46:27 Claus Reinke wrote: My idea was that case branches correspond to conditional jumps (though the exact correspondence and optimization has been the subject of countless papers). If I loop through a very long list, most of the time the test for (:) will succeed, requiring no jump, while the test for [] will fail, requiring a jump to the alternative branch. So, if GHC's pattern-match compilation is naive, the reordering will introduce 2 jumps into the common case of the loop where none would be needed, right? Module Test(test) where test :: [a] - Int test (a:b:c) = 2 test (a:[]) = 1 test [] = 0 gives the following cmm (with GHC 6.10.1 and -O2) Test_test_entry() { ... chn: if (Sp - 8 SpLim) goto chp; // RTS stack check for space R1 = R2; I64[Sp - 8] = sgO_info; // Argument evaluation return address Sp = Sp - 8; if (R1 7 != 0) goto chs;// Is argument already evaluated? jump I64[R1] (); // No, evaluate it chp: R1 = Test_test_closure; // RTS stack expansion (GC?) jump stg_gc_fun (); chs: jump sgO_info ();// Yes, go directly to return address } sgO_ret() { ... chg: _chh = R1 7;// Constructor tag is in lower ptr bits if (_chh = 2) goto chi; // Does the tag indicate (:)? R1 = Test_lvl2_closure+1; // No, load up closure for 0 and return Sp = Sp + 8; jump (I64[Sp + 0]) (); chi: R1 = I64[R1 + 14];// Yes, get the tail of (:) I64[Sp + 0] = sgQ_info; // Tail evaluation return address if (R1 7 != 0) goto chl;// Is tail already evaluated? jump I64[R1] (); // No, evaluate it chl: jump sgQ_info ();// Yes, go directly to return address } sgQ_ret() { ... cha: _chb = R1 7;// Constructor tag is in lower ptr bits if (_chb = 2) goto chc; // Does the tag indicate (:)? R1 = Test_lvl1_closure+1; // No, load up closure for 1 and return Sp = Sp + 8; jump (I64[Sp + 0]) (); chc: R1 = Test_lvl_closure+1; // Yes, load up closure for 2 and return Sp = Sp + 8; jump (I64[Sp + 0]) (); } Thus the trip is more like (assuming the first two (:) are already evaluated) test - chs (WHNF check -- i.e., first (:) is already evaluated) chs - sgO sg0 - chi (constructor check -- i.e., not []) chi - chl (WHNF check -- i.e., second (:) is already evaluated) chl - sgQ sgQ - chc (constructor check -- i.e., not (a:[])) chc - return Looking at the assembler, things are a bit better in that the the gotos that immediately execute a jump are just replaced with a jump. For example, the assembler for test gives (test - chs - sg0 is replaced with test - sg0) ... Test_test_info: .Lchn: leaq -8(%rbp),%rax// RTS stack check for return address cmpq %r14,%rax jb .Lchp movq %rsi,%rbx movq $sgO_info,-8(%rbp) // Argument evaluation return address addq $-8,%rbp testq $7,%rbx // Is argument already evaluated? jne sgO_info // Yes, go directly to return address jmp *(%rbx) // No, evaluate it .Lchp: movl $Test_test_closure,%ebx // RTS stack expansion (GC?) jmp *-8(%r13) ... sgO_info: .Lchg: movq %rbx,%rax// Constructor tag is in lower ptr bits andq $7,%rax cmpq $2,%rax // Does the tag indicate (:)? jae .Lchi movl $Test_lvl2_closure+1,%ebx// No, load up closure for 0 and return addq $8,%rbp jmp *(%rbp) .Lchi: movq 14(%rbx),%rbx// Yes, get the tail of (:) movq $sgQ_info,(%rbp) // Tail evaluation return address testq $7,%rbx // Is tail already evaluated? jne sgQ_info // No, evaluate it jmp *(%rbx) // Yes, go directly to return address ... Thus you actually get test - sg0 (WHNF check -- i.e., first (:) is already evaluated) sg0 - chi (constructor check -- i.e., not []) chi - sgQ (WHNF check -- i.e., second (:) is already evaluated) sgQ - chc (constructor check -- i.e., not (a:[])) chc - return I guess this is a long winded way of saying that the branches are being ordered such that the fall though case is not the one that you put first, which, if I recall correctly, is somewhat bad as the x86 branch predictor guesses a forward branch that hasn't been seen before will fall through. Perhaps they are being ordered by the constructor tag? Cheers! -Tyson PS: I reversed GHC's ordering of test, sgO, and sgQ for readability above. The test - sg0 and chi - sgQ jumps actually go backwards, which is actually what you want because, if I recall correctly, the x86 branch
Re: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler
sylvain sylvain.na...@googlemail.com writes: Le samedi 21 mars 2009 à 09:58 -0700, Don Stewart a écrit : Oh boy. Compile with optimizations on please! ghc -O2 et al. I had done that, actually, before even my first post, and knew that it changes little to the picture, at least on my system. I think Bulat was right on the money here: you're essentially testing the efficiency of writing integers. Presumably, JHC is better than GHC at specializing/inlining this library function. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [jhc] Re: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler
On Mon, Mar 23, 2009 at 08:40:02AM +0100, Ketil Malde wrote: I had done that, actually, before even my first post, and knew that it changes little to the picture, at least on my system. I think Bulat was right on the money here: you're essentially testing the efficiency of writing integers. Presumably, JHC is better than GHC at specializing/inlining this library function. Indeed, but isn't being better at specializing/inlining exactly what an optimizing compiler should do. :) In any case, these results are not atypical, generally, if jhc can compile something, it ends up being 2-3x faster than ghc. After all, C-comparable (or even superior) speed is the main goal of jhc development. And if anything, I am more convinced than when I started that the goal is achievable. With jhc today, C comparable performance from numerical code is not difficult to achieve with some attention to strictness annotations. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Cfp: WFLP09 - 18th Int'l Workshop on Functional and (Constraint) Logic Programming
*** Call For Papers WFLP 2009 18th International Workshop on Functional and (Constraint) Logic Programming Brasilia, Brazil, June, 28, 2009 http://www.dsic.upv.es/workshops/wflp09/ * part of the Federated Conference on Rewriting, Deduction, and Programming RDP'09 http://rdp09.cic.unb.br/index.html *** IMPORTANT DATES Abstract Submission April 20, 2009 Full Paper SubmissionApril 26, 2009 Acceptance Notification May 25, 2009 Preliminary Proceedings June 8, 2009 Workshop June 28, 2009 SCOPE The Workshop on Functional and (Constraint) Logic Programming aims at bringing togetherresearchers interested in functional programming, (constraint) logic programming, as well as the integration of the two paradigms. It promotes the cross-fertilizing exchange of ideas and experiences among researchers and students from the different communities interested in the foundations, applications, and combinations of high-level, declarative programming languages and related areas. The previous WFLP editions are: WFLP 2008 (Siena, Italy), WFLP 2007 (Paris, France), WFLP 2006 (Madrid, Spain), WCFLP 2005 (Tallinn, Estonia), WFLP 2004 (Aachen, Germany), WFLP 2003 (Valencia, Spain), WFLP 2002 (Grado, Italy), WFLP 2001 (Kiel, Germany), WFLP 2000 (Benicassim, Spain), WFLP'99 (Grenoble, France), WFLP'98 (Bad Honnef, Germany), WFLP'97 (Schwarzenberg, Germany), WFLP'96 (Marburg, Germany),WFLP'95 (Schwarzenberg, Germany), WFLP'94 (Schwarzenberg, Germany), WFLP'93 (Rattenberg, Germany), and WFLP'92 (Karlsruhe, Germany). LOCATION WFLP'09 will be held in June 28, 2009 at Brasilia, Brazil, as part of the Federated Conference on Rewriting, Deduction, and Programming (RDP'09). WFLP'09 solicits papers in all areas of functional and (constraint) logic programming, including but not limited to: * Foundations: formal semantics, rewriting andnarrowing, constraint solving, dynamics, type theory * Language Design: modulesand type systems, multi-paradigm languages, concurrency and distribution, objects * Implementation: abstract machines, parallelism, compile-time and run-time optimizations, interfacing with external languages * Transformationand Analysis: abstract interpretation, specialization, partial evaluation, program transformation, meta-programming * Software Engineering:design patterns, specification, verification and validation, debugging, test generation * Integration of Paradigms: integration of declarative programming with other paradigms such as imperative, object-oriented, concurrent, and real-time programming * Applications: security, declarative programming in education and industry, domain-specific languages, visual/graphical user interfaces, embedded systems, WWW applications, knowledge representation and machine learning,deductive databases, advanced programming environments and tools SUBMISSIONS and PROCEEDINGS Authors are invited to submit papers of at most 15 pages (pdf or postscript formats) presenting original, not previously published works. Submission categories include regular research papers, short papers (not more than 8 pages) describing on-going work, and system descriptions. Submissions must be formatted in the Lecture Notes in Computer Science style (excluding well-marked appendices not intended for publication). Papers should be submitted electronically via the web-based submission site http://www.easychair.org/conferences/?conf=wflp2009 Preliminary proceedings will be available at the workshop. Selected authors will be invited to submit a full version of their papers after the workshop. Contributions accepted for the post-workshop proceedings will be published in Lecture Notes in Computer Science. INVITED SPEAKERS Claude Kirchner INRIA Bordeaux - Sud-Ouest, France Roberto Ierusalimschy Departamento de Informatica, PUC-Rio, Brazil PROGRAM CHAIR Santiago Escobar Universidad Politecnica de Valencia, Spain PROGRAM COMMITTEE Maria AlpuenteUniversidad Politecnica de Valencia, Spain Sergio Antoy Portland State University, USA Christiano Braga Universidade Federal Fluminense, Brazil Rafael Caballero Universidad Complutense de Madrid, Spain David Deharbe Universidade Federal do Rio Grande do Norte, Brazil Rachid EchahedCNRS,laboratoire LIG, France Moreno Falaschi Universita di Siena, Italy Michael Hanus Christian-Albrechts-Universitaet zu Kiel, Germany Frank HuchChristian-Albrechts-Universitaet zu Kiel, Germany Tetsuo IdaUniversity of Tsukuba, Japan Wolfgang Lux Westfalische
[Haskell] ANNOUNCE: WinGhci, a GUI for GHCI on Windows
Hi, I am pleased to announce the first release of WinGhci. WinGhci is a simple GUI for GHCI on Windows. It is closely based on WinHugs, and provides similar functionality. WinGhci project web page: http://code.google.com/p/winghci/mhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://code.google.com/p/winghci/ Binaries: http://winghci.googlecode.com/files/WinGhci-1.0-bin.zipmhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://winghci.googlecode.com/files/WinGhci-1.0-bin.zip Sources: http://winghci.googlecode.com/files/WinGhci-1.0-src.zipmhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://winghci.googlecode.com/files/WinGhci-1.0-src.zip Acknowledgements Much of the code in WinGhci was taken from the Winhugs project. Many thanks to Neil Mitchell for giving us permission to use his code. mhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://winghci.googlecode.com/files/WinGhci-1.0-bin.zip Pepe Gallardo ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Hackage download and popularity statistics
For the first time, we've got download and popularity statistics from Hackage: http://www.galois.com/blog/2009/03/23/one-million-haskell-downloads/ Find out if your package made the top 100, and when we reach our 1 millionth hackage download! -- Don ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [jhc] Re: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler
Those are impressive results. Typically on programming language benchmarks, the speed of ghc-generated code fares well against C, sometimes outperforming it, at best being 20x faster, at worst being 3x slower. Since it already seems fast enough, I'm astonished that jhc could make it even faster. http://shootout.alioth.debian.org/u32q/benchmark.php?test=alllang=ghclang2=gccbox=1 Where ghc-generated code fares poorly against other languages is memory usage. Has there been an effort in jhc to reduce the memory footprint of generated code? How does it fare against ghc in this area? Thanks, Lyle On Mon, Mar 23, 2009 at 1:09 AM, John Meacham j...@repetae.net wrote: On Mon, Mar 23, 2009 at 08:40:02AM +0100, Ketil Malde wrote: I had done that, actually, before even my first post, and knew that it changes little to the picture, at least on my system. I think Bulat was right on the money here: you're essentially testing the efficiency of writing integers. Presumably, JHC is better than GHC at specializing/inlining this library function. Indeed, but isn't being better at specializing/inlining exactly what an optimizing compiler should do. :) In any case, these results are not atypical, generally, if jhc can compile something, it ends up being 2-3x faster than ghc. After all, C-comparable (or even superior) speed is the main goal of jhc development. And if anything, I am more convinced than when I started that the goal is achievable. With jhc today, C comparable performance from numerical code is not difficult to achieve with some attention to strictness annotations. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler
On Sat, Mar 21, 2009 at 10:00 AM, Don Stewart d...@galois.com wrote: Util/Gen.hs:6:7: Could not find module `Control.Monad.Identity': it was found in multiple packages: transformers-0.1.1.0 mtl-1.1.0.2 make[1]: *** [jhc] Error 1 ghc-pkg hide transformers-0.1.1.0 -- Taral tar...@gmail.com Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: Specific denotations for pure types
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Conal Elliott wrote: | The question I'm asking is this: Assuming compositional semantics, can | [[Bool]] be this simple customary three-value domain in the presence | of an implementation-dependent [[Int]] (given that Int expressions can | play a non-trivial role in Bool expressions)? As I understand it, your question might be reworded like this: If we can compose values of type (MachineInfo - Int) to create a value of type (MachineInfo - Bool), does that mean Bool is dependent on MachineInfo? To simplify the question, I would like to rephrase it further to ask whether the ability to construct any value of type (MachineInfo - Bool) means that Bool is dependent on MachineInfo. My (uneducated) reaction is that this does not mean that Bool is dependent on MachineInfo any more than the ability to construct a value of type (forall a. a - Bool) means that Bool is dependent on everything. - - Jake -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknHufsACgkQye5hVyvIUKnahACgq6JZLcSePAJ4RLylPyz3X2DC NwMAoLQilWKYfUf12BJhUle52bP/zM2J =NN7V -END PGP SIGNATURE- ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Re: Specific denotations for pure types
Oh! I think there's a misunderstanding here. I'm not talking about MachineInfo as visible in the types. I'm talking about Int itself having a MachineInfo-dependent semantic model (something like MachineInfo - Z, where MachineInfo, -, and Z are *semantic* types, not Haskell types). Making my question more specific: Can () on Int be given a compositional semantics, i.e. a semantics as [[Int]] - [[Int]] - [[Bool]], where [[Int]] = MachineInfo - Z and [[Bool]] = {bottom,false,true} (with the usual ordering)? - Conal On Mon, Mar 23, 2009 at 9:34 AM, Jake McArthur j...@pikewerks.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Conal Elliott wrote: | The question I'm asking is this: Assuming compositional semantics, can | [[Bool]] be this simple customary three-value domain in the presence | of an implementation-dependent [[Int]] (given that Int expressions can | play a non-trivial role in Bool expressions)? As I understand it, your question might be reworded like this: If we can compose values of type (MachineInfo - Int) to create a value of type (MachineInfo - Bool), does that mean Bool is dependent on MachineInfo? To simplify the question, I would like to rephrase it further to ask whether the ability to construct any value of type (MachineInfo - Bool) means that Bool is dependent on MachineInfo. My (uneducated) reaction is that this does not mean that Bool is dependent on MachineInfo any more than the ability to construct a value of type (forall a. a - Bool) means that Bool is dependent on everything. - - Jake -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknHufsACgkQye5hVyvIUKnahACgq6JZLcSePAJ4RLylPyz3X2DC NwMAoLQilWKYfUf12BJhUle52bP/zM2J =NN7V -END PGP SIGNATURE- ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Re: Specific denotations for pure types
And my own answer is no. Otherwise, dodgy would have value true, false, or bottom, rather than the value true-or-false-depending-on-the-machine. On Mon, Mar 23, 2009 at 9:39 AM, Conal Elliott co...@conal.net wrote: Oh! I think there's a misunderstanding here. I'm not talking about MachineInfo as visible in the types. I'm talking about Int itself having a MachineInfo-dependent semantic model (something like MachineInfo - Z, where MachineInfo, -, and Z are *semantic* types, not Haskell types). Making my question more specific: Can () on Int be given a compositional semantics, i.e. a semantics as [[Int]] - [[Int]] - [[Bool]], where [[Int]] = MachineInfo - Z and [[Bool]] = {bottom,false,true} (with the usual ordering)? - Conal On Mon, Mar 23, 2009 at 9:34 AM, Jake McArthur j...@pikewerks.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Conal Elliott wrote: | The question I'm asking is this: Assuming compositional semantics, can | [[Bool]] be this simple customary three-value domain in the presence | of an implementation-dependent [[Int]] (given that Int expressions can | play a non-trivial role in Bool expressions)? As I understand it, your question might be reworded like this: If we can compose values of type (MachineInfo - Int) to create a value of type (MachineInfo - Bool), does that mean Bool is dependent on MachineInfo? To simplify the question, I would like to rephrase it further to ask whether the ability to construct any value of type (MachineInfo - Bool) means that Bool is dependent on MachineInfo. My (uneducated) reaction is that this does not mean that Bool is dependent on MachineInfo any more than the ability to construct a value of type (forall a. a - Bool) means that Bool is dependent on everything. - - Jake -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknHufsACgkQye5hVyvIUKnahACgq6JZLcSePAJ4RLylPyz3X2DC NwMAoLQilWKYfUf12BJhUle52bP/zM2J =NN7V -END PGP SIGNATURE- ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Re: [Haskell-cafe] Help on using System.Win32.Com.Automation
Hi Wilkes, you may want to have a look at a simple example of how to interop with Windows WMI using the COM package at -- http://haskell.forkio.com/com-examples Hope it is of some help to you. --sigbjorn On 3/19/2009 16:49, Wilkes Joiner wrote: I'm playing around with the com package, but I'm having a hard time understanding how to map a COM call to the appropriate methodN or functionN call. Does anyone have any example code that uses the method1 or higher. Any help or pointers would be appreciated. Here's the code I have so far: import System.Win32.Com import System.Win32.Com.Automation dsn = Provider=vfpoledb.1;Data Source=C:\\SomeDirectory\\ main = coInitialize openConnection = \con - closeConnection con openDSN :: String - IDispatch a - IO () openDSN dsn con = method0 Open [inString dsn] con openConnection :: IO (IDispatch a) openConnection = createObject ADODB.Connection = \con - openDSN dsn con return con closeConnection :: IDispatch a - IO () closeConnection = method0 Close [] {- Wraps ADO Connection.Execute http://msdn.microsoft.com/en-us/library/ms675023(VS.85).aspx Set recordset = connection.Execute (CommandText, RecordsAffected, Options) execute :: String - IDispatch a - IO a execute cmd con = method1 Execute [inString cmd] (inEmpty,resWord64) con -} Thank You, Wilkes ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] MissingH bracketCD (aka bracketCWD) bug -- this is the infamous lazy io, right?
I got bitten by a bug (well, I call it bug) in bracketCD from HSH/MissingH demonstrated by the following code bracketCD is very useful for sysadminny one-offs, I use it all the time, but. I suspect that unless people are very careful, this behavior will affect other users of bracketCD, in potentially very subtle and tricky ways. 1) -- is there a more elegant way to deal with lazy io than the hack below? (putStrLn the last character) 2) -- should MissingH function bracketCD be fixed, and if so how? import System.FilePath.Find (find) import System.Directory (getDirectoryContents, getCurrentDirectory, setCurrentDirectory) import System.Path (bracketCWD) -- from MissingH -- the fixed function, a more restrictive type than bracketCWD which lets you do any io, not just showables myBracketCWD :: Show a = FilePath - IO a - IO a myBracketCWD fp action = do oldcwd - getCurrentDirectory setCurrentDirectory fp a - action putStrLn $ show . last . show $ a -- force evaluation setCurrentDirectory oldcwd return a -- rather than listing /, lists dir this module is in tWrong = bracketCWD / $ return . take 2 = listCurrentWithFind -- this lists filesystem root tRight = myBracketCWD / $ return . take 2 = listCurrentWithFind listCurrentWithFind = System.FilePath.Find.find (return True) (return True) . -- for some reason, bracketCWD does the right thing with get tGetContents = myBracketCWD / $ return . take 2 = getDirectoryContents . Actual code for bracketCWD in MissingH: -- this is from MissingH, seems there's a bug when attempt to wrap a find command bracketCWD :: FilePath - IO a - IO a bracketCWD fp action = do oldcwd - getCurrentDirectory setCurrentDirectory fp finally action (setCurrentDiurectory oldcwd) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Help on using System.Win32.Com.Automation
Sigbjorn Finne wrote: Hi Wilkes, you may want to have a look at a simple example of how to interop with Windows WMI using the COM package at -- http://haskell.forkio.com/com-examples I try compile WMIDemo.hs but recive error: [code] c:\htestghc --make WMIDemo.hs [2 of 2] Compiling WMIDemo ( WMIDemo.hs, WMIDemo.o ) WMIDemo.hs:24:2: Couldn't match expected type `[a]' against inferred type `(a1, b)' In the pattern: (_, ls) In a stmt of a 'do' expression: (_, ls) - is # enumVariants In the second argument of `($)', namely `do obj - Auto.getObject winmgmts:.\\root\\CIMV2 is - obj # instancesOf Win32_OperatingSystem (Nothing :: Maybe Int) (Nothing :: Maybe (IDispatch ())) (_, ls) - is # enumVariants case ls of { [] - fail Hmm..no OS information available; expected at least one. (wmi_os : _) - do ... }' [/code] ghc 6.10.1 com-1.2.1 Windows Vista Home Ru + sp1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MissingH bracketCD (aka bracketCWD) bug -- this is the infamous lazy io, right?
Excerpts from Thomas Hartman's message of Mon Mar 23 09:08:41 +0100 2009: I got bitten by a bug (well, I call it bug) in bracketCD from HSH/MissingH demonstrated by the following code bracketCD is very useful for sysadminny one-offs, I use it all the time, but. I suspect that unless people are very careful, this behavior will affect other users of bracketCD, in potentially very subtle and tricky ways. 1) -- is there a more elegant way to deal with lazy io than the hack below? (putStrLn the last character) Yes without changing the bracketCD function you can use a strict 'return' function to help you avoid leaks. return' :: (Monad m, NFData sa) - sa - m sa return' x = rnf x `seq` return x 2) -- should MissingH function bracketCD be fixed, and if so how? Not completely while staying in the full 'IO' monad. Have a look at the strict-io package [1] that goes in this direction. myBracketCWD :: (NFData sa, Show sa) = FilePath - SIO sa - IO sa myBracketCWD fp action = do oldcwd - getCurrentDirectory setCurrentDirectory fp a - SIO.run action rnf a `seq` setCurrentDirectory oldcwd return a The same function could be more deeply in the 'SIO' monad by returning in the 'SIO' monad. However this would require to first wrap getCurrentDirectory and setCurrentDirectory in the 'SIO' monad. Best regards, [1]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/strict-io -- Nicolas Pouillard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANN] Safe Lazy IO in Haskell
Excerpts from Henning Thielemann's message of Sun Mar 22 23:58:44 +0100 2009: On Sun, 22 Mar 2009, nicolas.pouillard wrote: It sounds like a nice idea, it would be great to have a straight-io package to play a bit more with explicit exceptions in things like 'IO'. Maybe I should then restrict lifting to LazyIO to SIO actions. That would not make LazyIO safe, but reduces surprises. By SIO you actually mean straight-io right? I was confused because I also have an SIO monad in the strict-io package. -- Nicolas Pouillard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] HSTringTemplate and syb-with-class
Hello all, I'm trying to use the generic capabilities of HSTringTemplate. The documentation claims that the package is able to automatically generate instances of ToSElem if syb-with-class is installed but gives no further details. I installed syb-with-class and then installed HSTringTemplate with additional configure parameter syb-with-class=True. But when I import Text.StringTemplate.GenericWithClass and then try deriving ToSElem or $(derive ToSElem), I just get an error like Can't make a derived instance of `ToSElem Any suggestions or pointer to further docs? Kind regards Torsten ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANN] Safe Lazy IO in Haskell
On Mon, 23 Mar 2009, nicolas.pouillard wrote: Excerpts from Henning Thielemann's message of Sun Mar 22 23:58:44 +0100 2009: On Sun, 22 Mar 2009, nicolas.pouillard wrote: It sounds like a nice idea, it would be great to have a straight-io package to play a bit more with explicit exceptions in things like 'IO'. Maybe I should then restrict lifting to LazyIO to SIO actions. That would not make LazyIO safe, but reduces surprises. By SIO you actually mean straight-io right? Yes I was confused because I also have an SIO monad in the strict-io package. Sorry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANN] Safe Lazy IO in Haskell
Excerpts from Henning Thielemann's message of Mon Mar 23 11:06:20 +0100 2009: On Mon, 23 Mar 2009, nicolas.pouillard wrote: Excerpts from Henning Thielemann's message of Sun Mar 22 23:58:44 +0100 2009: On Sun, 22 Mar 2009, nicolas.pouillard wrote: It sounds like a nice idea, it would be great to have a straight-io package to play a bit more with explicit exceptions in things like 'IO'. Maybe I should then restrict lifting to LazyIO to SIO actions. That would not make LazyIO safe, but reduces surprises. By SIO you actually mean straight-io right? Yes Then what do you mean by lifting to LazyIO to SIO actions? Do you mean liftSIO :: SIO a - LazyIO.T a which says that we only lift computations that explicitly throws exceptions. In that case it be actually safer, but all of this greatly depends on how reasonable is the explicit exception handling. In particular in the case 'IO', using explicit exception is maybe too heavy. -- Nicolas Pouillard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANN] Safe Lazy IO in Haskell
On Mon, 23 Mar 2009, nicolas.pouillard wrote: Excerpts from Henning Thielemann's message of Mon Mar 23 11:06:20 +0100 2009: Yes Then what do you mean by lifting to LazyIO to SIO actions? Do you mean liftSIO :: SIO a - LazyIO.T a which says that we only lift computations that explicitly throws exceptions. Yes. In that case it be actually safer, but all of this greatly depends on how reasonable is the explicit exception handling. If it does not fit, you can change it. :-) That's the advantage over built-in IO exceptions. In particular in the case 'IO', using explicit exception is maybe too heavy. I think it's precisely the best thing to do, given all the problems with asynchronous, imprecise and what-know-I exceptions. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: WinGhci, a GUI for GHCI on Windows
Hi, I am pleased to announce the first release of WinGhci. WinGhci is a simple GUI for GHCI on Windows. It is closely based on WinHugs, and provides similar functionality. WinGhci project web page: http://code.google.com/p/winghci/mhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://code.google.com/p/winghci/ Binaries: http://winghci.googlecode.com/files/WinGhci-1.0-bin.zipmhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://winghci.googlecode.com/files/WinGhci-1.0-bin.zip Sources: http://winghci.googlecode.com/files/WinGhci-1.0-src.zipmhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://winghci.googlecode.com/files/WinGhci-1.0-src.zip Acknowledgements Much of the code in WinGhci was taken from the Winhugs project. Many thanks to Neil Mitchell for giving us permission to use his code. mhtml:{5097F7F7-AA40-4661-A7CF-D5EEC38F084A}mid://0003/!x-usc:http://winghci.googlecode.com/files/WinGhci-1.0-bin.zip Pepe Gallardo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage upload problems?
Hello, Currently I'm trying to upload a minor update of Salvia to Hackage to fix some dependency issues but Hackage times out all the time? Both the CLI tool and the web-interface do not react to my upload request. Any known problems here? Gr, Sebastiaan. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Use unsafePerformIO to catch Exception?
Hi, I just feel it is not comfortable to deal with exceptions only within IO monad, so I defined tryArith :: a - Either ArithException a tryArith = unsafePerformIO . try . evaluate and it works quite good as map (tryArith . (div 5)) [2,1,0,5] evaluates to [Right 2,Right 5,Left divide by zero,Right 1] However, I guess unsafePerformIO definitely has a reason for its name. As I read through the document in System.IO.Unsafe, I can't convince myself whether the use of 'tryArith' is indeed safe or unsafe. I know there have been a lot of discussion around unsafePerformIO, but I still can't figure it out by myself. Can someone share some thoughts on this particular use of unsafePerformIO? Is it safe or not? And why? Thanks, Xiao-Yong -- c/*__o/* \ * (__ */\ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: SoC idea: interactive profiling
Hello, On Sun, Mar 22, 2009 at 04:08:59PM +0100, Alex Ott wrote: May be providing profiling information for kcachegrind will be a good solution? For example, there are tools for PHP, that allow to view collected information in kcachegrind, and get interactive zooming, etc. This is really awesome idea, you're totally not alone who would want this! -- Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Use unsafePerformIO to catch Exception?
You should ensure that the result of evaluate is in normal form, not just weak head normal form. You can do this with the Control.Parallel.Strategies module: import Control.Exception(ArithException(..),try,evaluate) import Control.Parallel.Strategies(NFData,using,rnf) import System.IO.Unsafe(unsafePerformIO) tryArith :: NFData a = a - Either ArithException a tryArith = unsafePerformIO . try . evaluate . flip using rnf test :: [Either ArithException Integer] test = map (tryArith . (div 5)) [2,1,0,5] testResult = [Right 2,Right 5,Left DivideByZero,Right 1] withPair :: Integer - (Integer,Integer) withPair x = (x,throw Overflow) main = do print (test == testResult) print (tryArith (withPair 7)) print (tryArith' (withPair 7)) in ghci *Main main main True Left arithmetic overflow Right (7,*** Exception: arithmetic overflow This rnf :: Strategy a ensures that the result of evaluate is in normal form. This means it should not have any embedded lazy thunks, so any errors from such thunks will be forced while in the scope of the try. Otherwise a complex type like the result of withPair can hide an error. Xiao-Yong Jin wrote: Hi, I just feel it is not comfortable to deal with exceptions only within IO monad, so I defined tryArith :: a - Either ArithException a tryArith = unsafePerformIO . try . evaluate and it works quite good as map (tryArith . (div 5)) [2,1,0,5] evaluates to [Right 2,Right 5,Left divide by zero,Right 1] However, I guess unsafePerformIO definitely has a reason for its name. As I read through the document in System.IO.Unsafe, I can't convince myself whether the use of 'tryArith' is indeed safe or unsafe. I know there have been a lot of discussion around unsafePerformIO, but I still can't figure it out by myself. Can someone share some thoughts on this particular use of unsafePerformIO? Is it safe or not? And why? Thanks, Xiao-Yong ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANNOUNCE: WinGhci, a GUI for GHCI on Windows
This is wonderful--just what I was waiting for! The application looks beautiful, and I'm very happy that GHCi now has a matching GUI application along the lines of WinHugs. It would be even better if you could provide some installation/uninstallation information. I unzipped the contents of WinGhci-1.0-bin.zip into the C:\Documents and Settings\username\My Documents\ folder, but there was no README file. Therefore, I simply ran Install.exe, and pressed Yes at the question to associate file extensions with winghci.exe. After some thought, I then decided that installing the application in the C:\Program Files\ folder would be better, but could not find any information on how to uninstall the application, so I just moved the folder and then re-ran Install.exe, again pressing Yes at the question to associate file extensions with winghci.exe. Is this the correct way to reinstall the application? Then, I ran StartGHCI.exe, but nothing seemed to happen, so I then ran winghci.exe, and the application started. Is this the correct way to start the application? I tried to check the winghci Wiki at http://code.google.com/p/winghci/w/list, but the project had no wiki pages. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] least fixed points above something
On Friday 20 March 2009 5:23:37 am Ryan Ingram wrote: On Fri, Mar 20, 2009 at 1:01 AM, Dan Doel dan.d...@gmail.com wrote: However, to answer Luke's wonder, I don't think fixAbove always finds fixed points, even when its preconditions are met. Consider: f [] = [] f (x:xs) = x:x:xs twos = 2:twos How about fixAbove f x = x `lub` fixAbove f (f x) Probably doesn't work (or give good performance) with the current implementation of lub :) But if lub did work properly, it should give the correct answer for fixAbove f (2:undefined). This looked good to me at first, too (assuming it works), and it handles my first example. But alas, we can defeat it, too: f (x:y:zs) = x:y:x:y:zs f zs = zs Now: f (2:_|_) = _|_ f _|_ = _|_ fix f = _|_ fixAbove f (2:_|_) = 2:_|_ `lub` _|_ `lub` _|_ ... = 2:_|_ Which is not a fixed point of f. But there are actually multiple choices of fixed points above 2:_|_ f (2:[]) = 2:[] forall n. f (cycle [2,n]) = cycle [2,n] I suppose the important distinction here is that we can't arrive at the fixed point simply by iterating our function on our initial value (possibly infinitely many times). I suspect this example won't be doable without an oracle of some kind. Ah well. -- Dan Thanks for all comments on my question, especially those bashing my poor code. The above approach does not apply to my case. What I have is a monotone function f on a partial order satisfying f x = x, for all x. Given that the partial order is in fact a cpo this is enough to guarantee that a least fixed point can be found above any point in the partial order simply by iterating f, although not necessarily in finite time. Taking the lub of x and the fixed point of f (over bottom) need not give a fixed point even if one exists. Think of reachability in a graph from a starting set. Let S be some fixed set, and let f return all points reachable in 0 or 1 step from the union of S and the argument to f. Then fix f is the set of points reachable from S, which is a fixed point. But adding some point x outside fix f will in general not give me a fixed point, even though a unique fixed point exists (the set reachable from the union of {x} and fix f). Jens ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANNOUNCE: WinGhci, a GUI for GHCI on Windows
Just another couple of thoughts for possible additional improvement: 1. It would be even nicer if WinGhci added a menu entry to the Start menu automatically, as WinHugs does. 2. For the proposed menu entry, it would also probably be a good idea if WinGhci added a folder for that menu entry, and included a link to a README file in there, as WinHugs does also. 3. In order to distinguish WinGhci from GHCi, it might also be helpful if WinGhci had a different icon; the current WinGhci icon is identical to the one for GHCi (perhaps use the forthcoming official Haskell logo here?). Just my two cents for now -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Use unsafePerformIO to catch Exception?
ChrisK hask...@list.mightyreason.com writes: You should ensure that the result of evaluate is in normal form, not just weak head normal form. You can do this with the Control.Parallel.Strategies module: import Control.Exception(ArithException(..),try,evaluate) import Control.Parallel.Strategies(NFData,using,rnf) import System.IO.Unsafe(unsafePerformIO) tryArith :: NFData a = a - Either ArithException a tryArith = unsafePerformIO . try . evaluate . flip using rnf test :: [Either ArithException Integer] test = map (tryArith . (div 5)) [2,1,0,5] testResult = [Right 2,Right 5,Left DivideByZero,Right 1] withPair :: Integer - (Integer,Integer) withPair x = (x,throw Overflow) main = do print (test == testResult) print (tryArith (withPair 7)) print (tryArith' (withPair 7)) in ghci *Main main main True Left arithmetic overflow Right (7,*** Exception: arithmetic overflow This rnf :: Strategy a ensures that the result of evaluate is in normal form. This means it should not have any embedded lazy thunks, so any errors from such thunks will be forced while in the scope of the try. Otherwise a complex type like the result of withPair can hide an error. Thanks a lot. I found it is much easier to deal with Exception with this than convert all my code to monadic style. -- c/*__o/* \ * (__ */\ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANNOUNCE: WinGhci, a GUI for GHCI on Windows
Benjamin L.Russell wrote: This is wonderful--just what I was waiting for! The application looks beautiful, and I'm very happy that GHCi now has a matching GUI application along the lines of WinHugs. Indeed - me too ! It would be even better if you could provide some installation/uninstallation information. I unzipped the contents of WinGhci-1.0-bin.zip into the C:\Documents and Settings\username\My Documents\ folder, but there was no README file. And version information - I tried it with GHC 6.4 and it died (Not Responding) What version of GHCi does it require? And no, I won't upgrade GHC just yet (this is the latest GHC/wxHaskell combo that works for me with GHCi...) -- Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Foundations and Methods Research Group Director. School of Computer Science and Statistics, Room F.13, O'Reilly Institute, Trinity College, University of Dublin http://www.cs.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] least fixed points above something
Am Montag, den 23.03.2009, 12:55 + schrieb Jens Blanck: The above approach does not apply to my case. What I have is a monotone function f on a partial order satisfying f x = x, for all x. Given that the partial order is in fact a cpo this is enough to guarantee that a least fixed point can be found above any point in the partial order which implies that every total value is a fixed point. simply by iterating f, although not necessarily in finite time. Since every total value is a fixed point of f, the infimum of all total values above x is an upper bound for the least fixed point above x. This upper bound can be found the following way: 1) Find a position p in x at which the value is bottom::T, such that type T has exactly one constructor. If there is no such position, you are ready. 2) If T has exactly one constructor, then replace the value at position p with that constructor, leaving the constructor arguments undefined for now. Go on with step 1. Let's call this upper bound y and assume a function glb that calculates the greatest lower bound of two values. Then you can 'frame' a value v into the interval [x, y] via the expression ((v `glb` y) `lub` x). This works, because y = x implies that (v `glb` y) and x have an upper bound in the CPO. Also, function f' v = ((f v `glb` y) `lub` x) is monotonic and expanding on the interval [x, y]. So we get: fixAbove f x = fix f' where f' v = (f v `glb` y) `lub` x y= ... -- see above Regards, Holger ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Sometimes I wish there was a global variable
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rafael Cunha de Almeida wrote: | Hello, | | I am writing a OpenGL program in haskell, it can be found in: | http://github.com/aflag/galo/tree/master | But I hope this e-mail will be self-contained :). | | My main function goes like this: | (...) | rotX - newIORef (0.0::GLfloat) | rotY - newIORef (0.0::GLfloat) | pos - newIORef (0.0::GLfloat, 0.0, 0.0) | | displayCallback $= display (map f range) rotX rotY pos | | keyboardMouseCallback $= Just (keyboardMouse rotX rotY pos) | (...) | | Notice that rotX, rotY and pos are meant to be used as comunication | between the keyboardMouse and display functions. They need to be set as | 0 first, so display won't do anything. Only when they user press a few | buttons that those values change, so display behaves accordanly. | | In a state-based language I would place display and keyboardMouse in one | module and let them communcate to each other like they want. In haskell, | I'm not quite sure how to do it except by that parameter passing style. | | I thought about how state-monad may help with that. But I'm not sure how | I'd make the state variable to be contained inside a | display/keyboardMouse module. Another way to do this would be something like this: ~main = do ~ ... ~ displayCallback $= initialDisplayFunction ~ keyboardMouseCallback $= keyboardMouseFunction ~ ... ~keyboardMouseFunction = do ~ rotX - ... ~ rotY - ... ~ pos - ... ~ ... ~ displayCallback $= display ... rotX rotY rotZ You could even write your own state monad that does this callback reassignment for you (perhaps by wrapping StateT s IO a), then you can forget about all this explicit parameter passing. - - Jake -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknHq+kACgkQye5hVyvIUKnX3ACeMLD8FLOTEya8can6veyp6cT3 ClMAnRdfl/DyOshvzlBF8QCtYgTf87fd =Bp4F -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage upload problems?
sfvisser: Hello, Currently I'm trying to upload a minor update of Salvia to Hackage to fix some dependency issues but Hackage times out all the time? Both the CLI tool and the web-interface do not react to my upload request. Any known problems here? Discussion taking place on libraries@ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage download and popularity statistics
For the first time, we've got download and popularity statistics from Hackage: http://www.galois.com/blog/2009/03/23/one-million-haskell-downloads/ Find out if your package made the top 100, and when we reach our 1 millionth hackage download! -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] RE: [ANN] Safe Lazy IO in Haskell
Nicolas Pouillard nicolas.pouillard at gmail.com writes: Hi folks, We have good news (nevertheless we hope) for all the lazy guys standing there. Since their birth, lazy IOs have been a great way to modularly leverage all the good things we have with *pure*, *lazy*, *Haskell* functions to the real world of files. We are happy to present the safe-lazy-io package [1] that does exactly this and is going to be explained and motivated in the rest of this post. Hi, Please let me know if I understood your code correctly. So, the SIO module is used only to ensure that the file processing is finished before the finalizer closes the file, right? In System.IO.Lazy.Input, run is defined as run :: NFData sa = LI sa - IO sa run = run' . fmap return' Can I change it to run = run' . fmap return ? I think the semantics is the same because run' will strictly force the processing anyway? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Help on using System.Win32.Com.Automation
Alexandr N. Zamaraev wrote: Sigbjorn Finne wrote: Hi Wilkes, you may want to have a look at a simple example of how to interop with Windows WMI using the COM package at -- http://haskell.forkio.com/com-examples I try compile WMIDemo.hs but recive error: [code] c:\htestghc --make WMIDemo.hs [2 of 2] Compiling WMIDemo ( WMIDemo.hs, WMIDemo.o ) WMIDemo.hs:24:2: Couldn't match expected type `[a]' against inferred type `(a1, b)' ... Hi, please upgrade to the latest version - 1.2.2 - of the com package for this example, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/com There's been some improvements to the lib, esp. the handling of enumerations (which is where that type error is coming from.) hth --sigbjorn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] A small display problem using Helium
Hello, I've written something simple: main:: IO () main= do lijn - getLine putStrLn lijn Now if I import it in Helium it will do the following: Test main test -- (here I'm typing test) test it will be displayed two times, why? Because it displays my input and the output of the function. Now I want to write a function that does NOT display my input, any suggestions how I can achieve this? Thanks in advance! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] System.Random.Shuffle fix
I was looking for a shuffling algorithm to shuffle mp3-playlists so was very happy to see System.Random.Shuffle: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/random-shuffle-0.0.2 However I get errors,non-exhaustive patterns in function shufleTree or extractTree depending how I call it. Errors are at the bottom. I fixed it but I don't have the math skills to see if I perhaps broke it statistically ... Here is my fix, someone (don't remember who, helped me a little): http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2789#a2789 the shuffle at the end is with the fix. *Freet S.shuffle [1..10] [1..3] Loading package syb ... linking ... done. Loading package base-3.0.3.0 ... linking ... done. Loading package old-locale-1.0.0.1 ... linking ... done. Loading package old-time-1.0.0.1 ... linking ... done. Loading package random-1.0.0.1 ... linking ... done. Loading package random-shuffle-0.0.2 ... linking ... done. [2,4,6*** Exception: src\System\Random\Shuffle.hs:(52,6)-(55,30): Non-exhaustive patterns in function shuffleTree *Freet S.shuffle [1..3] [1..10] [2,*** Exception: src\System\Random\Shuffle.hs:(66,6)-(79,27): Non-exhaustive patterns in function extractTree *Freet :load c:/ghc/ghc-6.10.1/progs/Mp3Player/Shuffle.hs [1 of 1] Compiling Shuffle ( C:\ghc\ghc-6.10.1\progs\Mp3Player\Shuffle.hs, interpreted ) Ok, modules loaded: Shuffle. *Shuffle shuffle [1..3] [1..10] [2,1,3] *Shuffle shuffle [1..10] [1..3] [2,4,6*** Exception: C:\ghc\ghc-6.10.1\progs\Mp3Player\Shuffle.hs:(27,13)-(31,30): Non-exhaustive patterns in function shuffle' *Shuffle shuffle [1..10] [1..10] [2,4,6,8,10,3,9,7,5,1] *Shuffle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] System.Random.Shuffle fix
friggin friggin ha scritto: I was looking for a shuffling algorithm to shuffle mp3-playlists so was very happy to see System.Random.Shuffle: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/random-shuffle-0.0.2 However I get errors,non-exhaustive patterns in function shufleTree or extractTree depending how I call it. Errors are at the bottom. During building you should only get warnings. Non exhaustive patterns are ok, you hit them only if the input data is incorret. Probably in these cases, error should be used. I fixed it but I don't have the math skills to see if I perhaps broke it statistically ... Here is my fix, someone (don't remember who, helped me a little): http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2789#a2789 the shuffle at the end is with the fix. *Freet S.shuffle [1..10] [1..3] Your input is not correct. If you read the source code (in a future version I'll add Haddock support): -- Given a sequence (e1,...en) to shuffle, and a sequence -- (r1,...r[n-1]) of numbers such that r[i] is an independent sample -- from a uniform random distribution [0..n-i], compute the -- corresponding permutation of the input sequence. I have added a convenience function `shuffle'`, where you just need to supply a random number generator. Note that the shuffle' function contains a bug; it should return the new random generator: shuffle' :: RandomGen gen = [a] - Int - gen - ([a], gen) I'm going to fix it in next version. [...] Regards Manlio ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hugs on iPhone
I saw Miguel Mitrofanov ( http://www.nabble.com/Hugs-on-the-iphone-td19478992.html) successfully ported Hugs to the iPhone. I'm now wondering if anyone has tried to get Apple's blessing to put this in the App Store? It would be really great to be able to try out little Haskell ideas as the mood strikes. Of course, it's kind of essential to have an editor of some kind for more significant programs... Thanks, Kirk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. 2) My iPod Touch is still running 1.1.4 firmware; I've heard it's not that easy on 2.0 and later. 3) Personally, I'd love to see ghc on iPhone. It could even persuade me to upgrade. On 23 Mar 2009, at 21:00, Kirk Martinez wrote: I saw Miguel Mitrofanov (http://www.nabble.com/Hugs-on-the-iphone-td19478992.html ) successfully ported Hugs to the iPhone. I'm now wondering if anyone has tried to get Apple's blessing to put this in the App Store? It would be really great to be able to try out little Haskell ideas as the mood strikes. Of course, it's kind of essential to have an editor of some kind for more significant programs... Thanks, Kirk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
Unfortunately the developers agreement expressly forbids the use of interpreters that load and run external programs. This is probably for the simple reason that it would be almost impossible to secure, or even guarantee that it wont exceed its space and mem usage bounds required by AppStore apps. Short answer: Jailbreak and install away :) 2009/3/23 Kirk Martinez kirk.marti...@gmail.com I saw Miguel Mitrofanov ( http://www.nabble.com/Hugs-on-the-iphone-td19478992.html) successfully ported Hugs to the iPhone. I'm now wondering if anyone has tried to get Apple's blessing to put this in the App Store? It would be really great to be able to try out little Haskell ideas as the mood strikes. Of course, it's kind of essential to have an editor of some kind for more significant programs... Thanks, Kirk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- We can't solve problems by using the same kind of thinking we used when we created them. - A. Einstein ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] SOC idea ticket: Rendering Engine
Hi! I've created a ticket for this idea: http://hackage.haskell.org/trac/summer-of-code/ticket/1572 Please write your opinion. I also put the source code here: http://code.google.com/p/lambdacube/ svn checkout *http*://lambdacube.googlecode.com/svn/trunk/lambdacube-read-only Cheers, Csaba Hruska ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ruwrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. 2) My iPod Touch is still running 1.1.4 firmware; I've heard it's not that easy on 2.0 and later. that's unfortunate. 3) Personally, I'd love to see ghc on iPhone. It could even persuade me to upgrade. On 23 Mar 2009, at 21:00, Kirk Martinez wrote: I saw Miguel Mitrofanov ( http://www.nabble.com/Hugs-on-the-iphone-td19478992.html) successfully ported Hugs to the iPhone. I'm now wondering if anyone has tried to get Apple's blessing to put this in the App Store? It would be really great to be able to try out little Haskell ideas as the mood strikes. Of course, it's kind of essential to have an editor of some kind for more significant programs... Thanks, Kirk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
I think he means a program running on the iPhone which allows you to open a terminal over an SSH session to other devices. The instance (I think) you're thinking of is where the SSH *server* runs on the iPhone. On Mon, Mar 23, 2009 at 2:46 PM, Miguel Mitrofanov miguelim...@yandex.ruwrote: On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- /jve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] SOC idea ticket: Rendering Engine
* Csaba Hruska csaba.hru...@gmail.com [2009-03-23 19:24:19+0100] Hi! I've created a ticket for this idea: http://hackage.haskell.org/trac/summer-of-code/ticket/1572 Please write your opinion. I also put the source code here: http://code.google.com/p/lambdacube/ svn checkout *http*://lambdacube.googlecode.com/svn/trunk/lambdacube-read-only Hi Csaba, this looks very promising! Correct command to checkout: svn checkout http://lambdacube.googlecode.com/svn/trunk/ lambdacube -- Roman I. Cheplyaka :: http://ro-che.info/ Don't let school get in the way of your education. - Mark Twain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
On Mon, Mar 23, 2009 at 11:46 AM, Miguel Mitrofanov miguelim...@yandex.ruwrote: On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. It sure can't... but you said a terminal application, not a terminal on the iphone :-) If you meant you wanted a shell on the iPhone for that, that's something different, but if you wanted the ability to deal with terminal sessions from a serial-like stream, that does exist. I agree ssh'ng to another server isn't that interesting but someone just committed a GHCI GUI for windows... I thought Hugs had such a thing already. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
On Mon, Mar 23, 2009 at 11:53 AM, John Van Enk vane...@gmail.com wrote: I think he means a program running on the iPhone which allows you to open a terminal over an SSH session to other devices. The instance (I think) you're thinking of is where the SSH *server* runs on the iPhone. Yeah I was talking about a terminal capability that can deal with all the lovely control codes of serial terminals. I thought this could serve as a front-end for something running with curses bindings, not that you need to open up the whole darned iphone to do this stuff. Dave On Mon, Mar 23, 2009 at 2:46 PM, Miguel Mitrofanov miguelim...@yandex.ruwrote: On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- /jve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: SOC idea ticket: Rendering Engine
Csaba Hruska csaba.hru...@gmail.com wrote: svn checkout *http*://lambdacube.googlecode.com/svn/trunk/lambdacube-read-only I think you mean svn co http://lambdacube.googlecode.com/svn/trunk I didn't do anything yet, except running the sample program. I get to see an ogre head and this: 8 k...@solaris trunk % ./example1 [.,..,car,.svn,packs,materials,models] [.,..,.svn,toonf2.frag,toonf2.vert,Example_CelShading.frag,Example_CelShading.vert,texturemapping.frag,texturemapping.vert,diffuse.frag,diffuse.vert,ambient.frag,ambient.vert] [.,..,.svn,todo,Ogre.material,jaiqua.material,Scene.material,ogrehead.material,Robot.material,RZR-002.material] load: Ogre.material load: jaiqua.material load: Scene.material load: ogrehead.material load: Robot.material load: RZR-002.material [.,..,.svn,cel_shading_diffuse.png,r2skin.jpg,RZR-002.png,cel_shading_specular.png,cel_shading_edge.png,GreenSkin.jpg,spheremap.png,WeirdEye.png,dirt01.jpg,blue_jaiqua.jpg] [.,..,.svn,Cube.mesh.xml,ogrehead.mesh.xml,athene.mesh.xml,ninja.mesh.xml,Suzanne.mesh.xml,RZR-002.mesh.xml,facial.mesh.xml,robot.skeleton.xml,robot.mesh.xml,jaiqua.mesh.xml] [.,..,.svn,scooby_body.mesh.xml,scooby_body.material,ventanas.jpg,chasis.jpg,chasis_a.jpg] load: scooby_body.material creating entity: OgreHead from mesh: ogrehead.mesh.xml parsing XML file [Ogre/Tusks,Ogre/Earring,Ogre/Skin,Ogre/Eyes] compiling material: Ogre/Eyes WeirdEye.png loaded resolution = 256 x 256, 3 bytes per pixel compiling material: Ogre/Skin GreenSkin.jpg loaded resolution = 256 x 256, 3 bytes per pixel compiling material: Ogre/Earring spheremap.png loaded resolution = 256 x 256, 3 bytes per pixel compiling material: Ogre/Tusks dirt01.jpg loaded resolution = 96 x 96, 3 bytes per pixel done creating entity: Robot from mesh: robot2.mesh.xml parsing XML file [Examples/Robot] compiling material: Examples/Robot r2skin.jpg loaded resolution = 512 x 512, 3 bytes per pixel Compiling program: (Just Examples/AmbientShadingVP,Just Examples/AmbientShadingFP) Shader info log for 'Examples/AmbientShadingVP': Shader info log for 'Examples/AmbientShadingFP': Program info log: done creating entity: Car from mesh: scooby_body.mesh.xml parsing XML file [Ac3d/Scooby_Body/Mat001_Tex03,Ac3d/Scooby_Body/Mat001_Tex02,Ac3d/Scooby_Body/Mat001_Tex01] compiling material: Ac3d/Scooby_Body/Mat001_Tex01 chasis.jpg loaded resolution = 512 x 512, 3 bytes per pixel compiling material: Ac3d/Scooby_Body/Mat001_Tex02 ventanas.jpg loaded resolution = 512 x 512, 3 bytes per pixel compiling material: Ac3d/Scooby_Body/Mat001_Tex03 chasis_a.jpg loaded resolution = 128 x 256, 3 bytes per pixel done 1 frames in 13.45548 seconds = 7.431916215549353e-2 FPS zsh: abort ./example1 8 I _think_ example1 is killed by SIGABRT, but I could be wrong, I've never seen this before. Anyway, it's a strange thing. OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce 7600 GS/PCI/SSE2 OpenGL version string: 2.1.2 NVIDIA 177.82 OpenGL shading language version string: 1.20 NVIDIA via Cg compiler X.Org X Server 1.5.3 Linux solaris 2.6.28-tuxonice-r1 #20 PREEMPT Tue Mar 10 19:07:36 CET 2009 x86_64 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux The Glorious Glasgow Haskell Compilation System, version 6.10.1 -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: SOC idea ticket: Rendering Engine
2009/3/23 Achim Schneider bars...@web.de Csaba Hruska csaba.hru...@gmail.com wrote: svn checkout *http*://lambdacube.googlecode.com/svn/trunk/lambdacube-read-only I think you mean svn co http://lambdacube.googlecode.com/svn/trunk I didn't do anything yet, except running the sample program. I get to see an ogre head and this: 8 k...@solaris trunk % ./example1 [.,..,car,.svn,packs,materials,models] [.,..,.svn,toonf2.frag,toonf2.vert,Example_CelShading.frag,Example_CelShading.vert,texturemapping.frag,texturemapping.vert,diffuse.frag,diffuse.vert,ambient.frag,ambient.vert] [.,..,.svn,todo,Ogre.material,jaiqua.material,Scene.material,ogrehead.material,Robot.material,RZR-002.material] load: Ogre.material load: jaiqua.material load: Scene.material load: ogrehead.material load: Robot.material load: RZR-002.material [.,..,.svn,cel_shading_diffuse.png,r2skin.jpg,RZR-002.png,cel_shading_specular.png,cel_shading_edge.png,GreenSkin.jpg,spheremap.png,WeirdEye.png,dirt01.jpg,blue_jaiqua.jpg] [.,..,.svn,Cube.mesh.xml,ogrehead.mesh.xml,athene.mesh.xml,ninja.mesh.xml,Suzanne.mesh.xml,RZR-002.mesh.xml,facial.mesh.xml,robot.skeleton.xml,robot.mesh.xml,jaiqua.mesh.xml] [.,..,.svn,scooby_body.mesh.xml,scooby_body.material,ventanas.jpg,chasis.jpg,chasis_a.jpg] load: scooby_body.material creating entity: OgreHead from mesh: ogrehead.mesh.xml parsing XML file [Ogre/Tusks,Ogre/Earring,Ogre/Skin,Ogre/Eyes] compiling material: Ogre/Eyes WeirdEye.png loaded resolution = 256 x 256, 3 bytes per pixel compiling material: Ogre/Skin GreenSkin.jpg loaded resolution = 256 x 256, 3 bytes per pixel compiling material: Ogre/Earring spheremap.png loaded resolution = 256 x 256, 3 bytes per pixel compiling material: Ogre/Tusks dirt01.jpg loaded resolution = 96 x 96, 3 bytes per pixel done creating entity: Robot from mesh: robot2.mesh.xml parsing XML file [Examples/Robot] compiling material: Examples/Robot r2skin.jpg loaded resolution = 512 x 512, 3 bytes per pixel Compiling program: (Just Examples/AmbientShadingVP,Just Examples/AmbientShadingFP) Shader info log for 'Examples/AmbientShadingVP': Shader info log for 'Examples/AmbientShadingFP': Program info log: done creating entity: Car from mesh: scooby_body.mesh.xml parsing XML file [Ac3d/Scooby_Body/Mat001_Tex03,Ac3d/Scooby_Body/Mat001_Tex02,Ac3d/Scooby_Body/Mat001_Tex01] compiling material: Ac3d/Scooby_Body/Mat001_Tex01 chasis.jpg loaded resolution = 512 x 512, 3 bytes per pixel compiling material: Ac3d/Scooby_Body/Mat001_Tex02 ventanas.jpg loaded resolution = 512 x 512, 3 bytes per pixel compiling material: Ac3d/Scooby_Body/Mat001_Tex03 chasis_a.jpg loaded resolution = 128 x 256, 3 bytes per pixel done Until this point it is OK. (sorry for the lots of debug info, i'll remove them later) 1 frames in 13.45548 seconds = 7.431916215549353e-2 FPS The FPS calculation is wrong at first frame. I have a geforce 7300 GS and its running at ~670 FPS in 640x480 sized window. The example uses glsl shader. (if you remove robot from the scene then it will be compatible with older graphic cards too) Please press ESC to exit from example program instead of closing the window. The screenshot (http://code.google.com/p/lambdacube/) is taken from example1, you should get same one. zsh: abort ./example1 8 I _think_ example1 is killed by SIGABRT, but I could be wrong, I've never seen this before. Anyway, it's a strange thing. Does the program exit immediatly after the first rendered frame? OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce 7600 GS/PCI/SSE2 OpenGL version string: 2.1.2 NVIDIA 177.82 OpenGL shading language version string: 1.20 NVIDIA via Cg compiler X.Org X Server 1.5.3 Linux solaris 2.6.28-tuxonice-r1 #20 PREEMPT Tue Mar 10 19:07:36 CET 2009 x86_64 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux The Glorious Glasgow Haskell Compilation System, version 6.10.1 I've tested with ghc 6.10.1 on amd sempron 1800+ 32 bit gnu/linux geforce 7300gs. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: SOC idea ticket: Rendering Engine
Csaba Hruska csaba.hru...@gmail.com wrote: I _think_ example1 is killed by SIGABRT, but I could be wrong, I've never seen this before. Anyway, it's a strange thing. Does the program exit immediatly after the first rendered frame? Usually yes, sometimes I'm seeing the ogre being rotated before SIGABRT. At first I thought it might be the app getting confused by xmonad resizing it, but switching to twm or kwm didn't help. I'm going to investigate a bit further as soon as I figured out why xmonad doesn't use xinerama(again) after re-compilation. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Hugs on iPhone
Doesn't Apple Store restrict applications (by policy) so they cannot generate or execute arbitrary code? (That's the reason there's no Flash for iPhone.) That restriction seems like it'd block any interpreter or compiler from being sold, no? -Michael From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of David Leimbach Sent: Monday, March 23, 2009 12:59 PM To: John Van Enk Cc: haskell-cafe@haskell.org; Miguel Mitrofanov Subject: Re: [Haskell-cafe] Hugs on iPhone On Mon, Mar 23, 2009 at 11:53 AM, John Van Enk vane...@gmail.commailto:vane...@gmail.com wrote: I think he means a program running on the iPhone which allows you to open a terminal over an SSH session to other devices. The instance (I think) you're thinking of is where the SSH *server* runs on the iPhone. Yeah I was talking about a terminal capability that can deal with all the lovely control codes of serial terminals. I thought this could serve as a front-end for something running with curses bindings, not that you need to open up the whole darned iphone to do this stuff. Dave On Mon, Mar 23, 2009 at 2:46 PM, Miguel Mitrofanov miguelim...@yandex.rumailto:miguelim...@yandex.ru wrote: On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.rumailto:miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.orgmailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- /jve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Hugs on iPhone
Miguel Mitrofanov wrote: 3) Personally, I'd love to see ghc on iPhone. It could even persuade me to upgrade. See the GHC-on-ARM page[1] for my work on it last summer, among others'. GHC is tough to port because bootstrapping to new architectures has been broken for a long time, since soon after 6.6.2. My attempts to cross-compile 6.6.1 using the development environment for my Nokia N810 failed, as can be seen in [1]. I attempted several times to build Hugs for it: it would build successfully and then fail to run either on the device, in scratchbox, or natively compiled on x86 because it failed to find the Prelude. I suspect I was doing something wrong in building Hugs, something unrelated to the ARM platform. The good news is that jhc's portable C code works perfectly well -- but of course that is simply running precompiled Haskell apps and not a compiler or interpreter running on the device. Since jhc is not self-hosting (yet?) but instead is built with GHC, that's the best we can do with that approach for now. Braden Shepherdson shepheb [1] http://hackage.haskell.org/trac/ghc/wiki/ArmLinuxGhc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on iPhone
http://www.readwriteweb.com/archives/confirmed_apple_and_adobe_coll.php On 23 Mar 2009, at 23:29, Michael Giagnocavo wrote: Doesn’t Apple Store restrict applications (by policy) so they cannot generate or execute arbitrary code? (That’s the reason there’s no Flash for iPhone.) That restriction seems like it’d block any interpreter or compiler from being sold, no? -Michael From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org ] On Behalf Of David Leimbach Sent: Monday, March 23, 2009 12:59 PM To: John Van Enk Cc: haskell-cafe@haskell.org; Miguel Mitrofanov Subject: Re: [Haskell-cafe] Hugs on iPhone On Mon, Mar 23, 2009 at 11:53 AM, John Van Enk vane...@gmail.com wrote: I think he means a program running on the iPhone which allows you to open a terminal over an SSH session to other devices. The instance (I think) you're thinking of is where the SSH *server* runs on the iPhone. Yeah I was talking about a terminal capability that can deal with all the lovely control codes of serial terminals. I thought this could serve as a front-end for something running with curses bindings, not that you need to open up the whole darned iphone to do this stuff. Dave On Mon, Mar 23, 2009 at 2:46 PM, Miguel Mitrofanov miguelim...@yandex.ru wrote: On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- /jve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Hugs on iPhone
Guess they ended up making an exception for Flash, finally. Will be interesting to see how they prevent 3rd party stores from running arbitrary Flash games and whatnot. Maybe they'll blacklist any popular sites that are stealing marketshare from the AppStore? -Michael -Original Message- From: Miguel Mitrofanov [mailto:miguelim...@yandex.ru] Sent: Monday, March 23, 2009 2:52 PM To: Michael Giagnocavo Cc: David Leimbach; John Van Enk; haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Hugs on iPhone http://www.readwriteweb.com/archives/confirmed_apple_and_adobe_coll.php On 23 Mar 2009, at 23:29, Michael Giagnocavo wrote: Doesn't Apple Store restrict applications (by policy) so they cannot generate or execute arbitrary code? (That's the reason there's no Flash for iPhone.) That restriction seems like it'd block any interpreter or compiler from being sold, no? -Michael From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org ] On Behalf Of David Leimbach Sent: Monday, March 23, 2009 12:59 PM To: John Van Enk Cc: haskell-cafe@haskell.org; Miguel Mitrofanov Subject: Re: [Haskell-cafe] Hugs on iPhone On Mon, Mar 23, 2009 at 11:53 AM, John Van Enk vane...@gmail.com wrote: I think he means a program running on the iPhone which allows you to open a terminal over an SSH session to other devices. The instance (I think) you're thinking of is where the SSH *server* runs on the iPhone. Yeah I was talking about a terminal capability that can deal with all the lovely control codes of serial terminals. I thought this could serve as a front-end for something running with curses bindings, not that you need to open up the whole darned iphone to do this stuff. Dave On Mon, Mar 23, 2009 at 2:46 PM, Miguel Mitrofanov miguelim...@yandex.ru wrote: On 23 Mar 2009, at 21:38, David Leimbach wrote: On Mon, Mar 23, 2009 at 11:22 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: 1) You'll need a terminal application first, and I'm not sure if there is one in AppStore. In fact, I AM sure there isn't. There's SSH terminal programs like Putty based stuff that are in the AppStore. So that sort of thing has been done yes. You sure it can SSH to iPhone itself? Installing Hugs (or GHC) on a desktop PC and connecting to it via ssh is anything but impressive. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- /jve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Function to cast types
On 23 Mar 2009, at 2:20 am, Anonymous Anonymous wrote: Hello, I'm new to haskell, I'm wondering how can you write a function that will do the following: fromIntToString :: Int - String this is a cast function to cast an Int to a String. It cannot be. What could it possibly mean to cast an Int to anything, let alone a string? Haskell isn't C. (Nor is it PL/I.) What to do depends on what you _want_ to do. For example, fromIntToString n = replicate n 'I' will convert 1 to I, 2 to II, 3 to III, and so on. Assuming that you mean that you want a decimal representation of the integer, Read The Fine Manual to find out what 'show' will do. This may well be a homework question, in which case consider: you want to construct an element of a recursively defined data type (list of character). do you *have* a recursively defined data type to start from? If you first distinguish between negative and non-negative integers, do you have a recursively defined data type then? How could you use `div` and `mod` to treat non-negative integers _as if_ they formed a recursively defined data type? What would the base case be? What would the step case be? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Hugs on iPhone
On Mon, Mar 23, 2009 at 04:41:04PM -0400, Braden Shepherdson wrote: The good news is that jhc's portable C code works perfectly well -- but of course that is simply running precompiled Haskell apps and not a compiler or interpreter running on the device. Since jhc is not self-hosting (yet?) but instead is built with GHC, that's the best we can do with that approach for now. I wondered what would happen if I submitted some jhc generated C for approval, it _almost_ looks like it could have been hand written by someone with an unusual penchant for gotos and their own inscrutable hungarian notation. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HSTringTemplate and syb-with-class
You don't need to derive ToSElem -- you get the instance for free if you derive Data. Import GenericWithClass to get the instance for Data from syb-with-class, and import GenericStandard for use with Data from the vanilla syb that comes with GHC. Cheers, Sterl. 2009/3/23 Kemps-Benedix Torsten torsten.kemps-bene...@sks-ub.de: Hello all, I’m trying to use the generic capabilities of HSTringTemplate. The documentation claims that the package is able to automatically generate instances of ToSElem if syb-with-class is installed but gives no further details. I installed syb-with-class and then installed HSTringTemplate with additional configure parameter syb-with-class=True. But when I import Text.StringTemplate.GenericWithClass and then try deriving ToSElem or $(derive ToSElem), I just get an error like “Can't make a derived instance of `ToSElem …”. Any suggestions or pointer to further docs? Kind regards Torsten ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Hugs on iPhone
This is solely the reason for my interest in JHC. The agreement doesn't specifically prohibit the use of interpreters (just those than run external code). It also doesn't say anything about machine generated code. The only thing one would have to ensure is that the dependencies of JHC are all compiled in, or statically linked. Shared libs are disallowed in any app. If it has a runtime dependency on gcc (is there such a thing?) Then you would have to statically link it and therefore couldn't sell your application. (gotta love GPL) JHC also helps with another issue: There is some concern about garbage collection schemes, Apple removed their own garbage collector in the iPhone SDK and the docs mention that GC isn't allowed. But there is nothing about that in the Developer Agreement. JHC's region based memory management very closely reflects Apples own convention for using memory pools for all allocation. I speculate that this would less likely to be rejected. . There is also some discussion on both the GHC and JHC mailing list WRT this a month or two ago. I will attempt exactly this scheme later next month, will let you know how it goes. :) On Mon, Mar 23, 2009 at 5:45 PM, John Meacham j...@repetae.net wrote: On Mon, Mar 23, 2009 at 04:41:04PM -0400, Braden Shepherdson wrote: The good news is that jhc's portable C code works perfectly well -- but of course that is simply running precompiled Haskell apps and not a compiler or interpreter running on the device. Since jhc is not self-hosting (yet?) but instead is built with GHC, that's the best we can do with that approach for now. I wondered what would happen if I submitted some jhc generated C for approval, it _almost_ looks like it could have been hand written by someone with an unusual penchant for gotos and their own inscrutable hungarian notation. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- We can't solve problems by using the same kind of thinking we used when we created them. - A. Einstein ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] generalized shuffle
Hi. I have implemented a generalized shuffle function, for the random-shuffle package http://hackage.haskell.org/cgi-bin/hackage-scripts/package/random-shuffle I have not yet commited the change, before that I would like to receive some feedbacks (especially by the original author of the shuffle function, in Cc) The new function is defined in this example: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2808 Note that it make use of functions not exported by the System.Random.Shuffle module. I have generalized the original shuffle function in two ways: 1) It is now possible to obtain a random sample from a sequence, by doing, as an example: shuffles [1..10] [2, 3, 4, 2, 1] Note that this is equivalent at taking the first 5 elements of the full shuffled sequence, and the performance are pratically the same. 2) It is now possible to pass an infinite r-sequence to the shuffle function, as an example: shuffles [1..10] $ cycle [9, 8 .. 1] The result is an infinite list, with elements cyclically extracted from the r-sequence. When the r-sequence contains random numbers, we get an infinite sequence containing all possible random choices of elements in the original sequence. Why I'm doing this? The reason is that in a project I need to extract random elements from a list (and I need to extract a lot of them), and using normal methods [1] seems to be rather inefficient. Using the `shuffles` function should be much more efficient, since it uses a tree, and this tree is built only once. [1] by normal method I mean: extract a random number, in the range [0, n] (where n is the length of the sequence), and get the element indexed by that number. Indexing for a list if very expensive. And it is not very fast, even using arrays (unless you use non portable unsafeRead). Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?
On Mon, 23 Mar 2009, Xiao-Yong Jin wrote: Hi, I just feel it is not comfortable to deal with exceptions only within IO monad, so I defined tryArith :: a - Either ArithException a tryArith = unsafePerformIO . try . evaluate and it works quite good as map (tryArith . (div 5)) [2,1,0,5] evaluates to [Right 2,Right 5,Left divide by zero,Right 1] However, I guess unsafePerformIO definitely has a reason for its name. As I read through the document in System.IO.Unsafe, I can't convince myself whether the use of 'tryArith' is indeed safe or unsafe. Try to never use exception handling for catching programming errors! Division by zero is undefined, thus a programming error when it occurs. http://www.haskell.org/haskellwiki/Error http://www.haskell.org/haskellwiki/Exception I'm afraid, a Maybe or Either or Exceptional (see explicit-exception package) return value is the only way to handle exceptional return values properly. Maybe in the larger context of your problem zero denominators can be avoided? Then go this way. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?
Xiao-Yong Jin wrote: Hi, I just feel it is not comfortable to deal with exceptions only within IO monad, so I defined tryArith :: a - Either ArithException a tryArith = unsafePerformIO . try . evaluate [...] However, I guess unsafePerformIO definitely has a reason for its name. As I read through the document in System.IO.Unsafe, I can't convince myself whether the use of 'tryArith' is indeed safe or unsafe. I know there have been a lot of discussion around unsafePerformIO, but I still can't figure it out by myself. Can someone share some thoughts on this particular use of unsafePerformIO? Is it safe or not? And why? This use of unsafePerformIO is safe, because the original expression you're given is pure[1]. The evaluate lifts the pure value into IO in order to give evaluation-ordering guarantees, though otherwise has no effects. The unsafePerformIO voids those effects, since it makes the value pure again and thus it does not need to grab the RealWorld baton. Note that the correctness argument assumes the value is indeed pure. Some idiot could have passed in (unsafePerformIO launchTheMissiles), which is not safe and the impurity will taint anything that uses it (tryArith, (+1), whatever). But it's the unsafePerformIO in this expression which is bad, not the one in tryArith. tryArith is basically the same as a function I have in my personal utility code: http://community.haskell.org/~wren/wren-extras/Control/Exception/Extras.hs The safely function is somewhat different in that it's a combinator for making *functions* safe, rather than making *expressions* safe as tryArith does. This is necessary because exceptional control flow (by definition) does not honor the boundaries of expressions, but rather attaches semantics to the evaluation of functions. Thus safely is more safe because it ensures you can't force the exception prematurely via sharing: let x = 5`div`0 in ... seq x ... tryArith x -- too late to catch it! oops. Whereas with safely we'd have: let f y = safely (div y) in let x = 5 `f` 0 in ... seq x ... x -- doesn't matter where f or x are used. [1] Ha! If it were _pure_ then it wouldn't be throwing exceptions, now would it :) -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Learning Haskell
How long did it take you to become proficient in Haskell? By that, I mean - how long until you were just as comfortable with Haskell as you were with your strongest language at that time? -- View this message in context: http://www.nabble.com/Learning-Haskell-tp22673552p22673552.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Learning Haskell
I've been messing with Haskell since the Middle of January on evenings and weekends. Just now I'm getting to the point where I can construct nontrivial programs with little help from #haskell. It is by no means my most proficient language, I've been coding C++ and other languages for over 10 years. It is by far my favorite, however, and if I could do it full time I would. On Mon, Mar 23, 2009 at 11:08 PM, Tom.Amundsen tomamund...@gmail.comwrote: How long did it take you to become proficient in Haskell? By that, I mean - how long until you were just as comfortable with Haskell as you were with your strongest language at that time? -- View this message in context: http://www.nabble.com/Learning-Haskell-tp22673552p22673552.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- We can't solve problems by using the same kind of thinking we used when we created them. - A. Einstein ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Learning Haskell
I second that! Haskell is a very fun and engaging language (with its accompanying corpus of theorems, and its great community)... My timing is a little bit longer than Rick's... I've been eyeing Haskell for about 8 months, reading books, poking around etc. I've started to feel comfortable enough in the last month to begin a serious(ish) project. For my debut, I'm trying to build a game with HOpenGL. I wouldn't take my 8-month timeline as much of a benchmark, however, since I have not been very deeply involved in studying the language (I have no projects that require day-to-day coding in Haskell). Duane Johnson http://blog.inquirylabs.com/ On Mar 23, 2009, at 9:13 PM, Rick R wrote: I've been messing with Haskell since the Middle of January on evenings and weekends. Just now I'm getting to the point where I can construct nontrivial programs with little help from #haskell. It is by no means my most proficient language, I've been coding C++ and other languages for over 10 years. It is by far my favorite, however, and if I could do it full time I would. On Mon, Mar 23, 2009 at 11:08 PM, Tom.Amundsen tomamund...@gmail.com wrote: How long did it take you to become proficient in Haskell? By that, I mean - how long until you were just as comfortable with Haskell as you were with your strongest language at that time? -- View this message in context: http://www.nabble.com/Learning-Haskell-tp22673552p22673552.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- We can't solve problems by using the same kind of thinking we used when we created them. - A. Einstein ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Learning Haskell
Still struggling after almost year (I learn it along with Prolog, Lua, and many other non-C family languages), because I'm not very good at describing solutions. My imperative background is quite strong, but I've been able to switch more easily these days (after taking Functional Programming class at college). -- View this message in context: http://www.nabble.com/Learning-Haskell-tp22673552p22673952.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe