Re: [GHC] #3380: [Patch] Support implicit concatenation in list comprehensions
#3380: [Patch] Support implicit concatenation in list comprehensions -+-- Reporter: batterseapower|Owner: Type: feature request | Status: new Priority: normal|Milestone: _|_ Component: Compiler | Version: 6.10.4 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonpj): * milestone: 6.14.1 = _|_ Comment: I've just read the thread. My impression is that support is luke-warm at best. I'll milestone this as _|_ so that it's not forgotten, but meanwhile I am disinclined to take action. (Many responders were enthusiastic about tuple sections, which are indeed now implemented. Thanks for doing that.) Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3380#comment:10 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] #3458: Allocation where none should happen
#3458: Allocation where none should happen ---+ Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 6.10.1 | Severity: normal Keywords: | Testcase: Os: Linux | Architecture: x86_64 (amd64) ---+ These two functions, according to profiling, do a lot of allocation: gen d r n m s p | r == ll = do pokeElemOff p n 0x0a gen d 0 (n+1) (m+1) s p | n == m= do pokeElemOff p n 0x0a return (s, if r == 0 then m else m+1) | otherwise = do let t = next s pokeElemOff p n (pick d t) gen d (r+1) (n+1) m t p pick (c, p) r = loop 0 where loop i = if r unsafeAt p i then fromIntegral $ unsafeAt c i :: Word8 else loop (i+1) Core for pick: [GlobalId] [Arity 3 NoCafRefs Str: DmdType LLL] $w$spick_r3kC = \ (ww_s33o :: GHC.Prim.ByteArray#) (ww1_s33v :: GHC.Prim.ByteArray#) (ww2_s33A :: GHC.Prim.Word#) - letrec { $wloop_s38I :: GHC.Prim.Int# - GHC.Prim.Word# [Arity 1 Str: DmdType L] $wloop_s38I = \ (ww3_s339 :: GHC.Prim.Int#) - __scc {pick main:Main !} case GHC.Prim.ltWord# ww2_s33A (GHC.Prim.indexWord32Array# ww1_s33v ww3_s339) of wild_X3O { GHC.Bool.False - $wloop_s38I (GHC.Prim.+# ww3_s339 1); GHC.Bool.True - GHC.Prim.narrow8Word# (GHC.Prim.indexWord32Array# ww_s33o ww3_s339) }; } in case __scc {pick main:Main} case $wloop_s38I 0 of ww3_s33d { __DEFAULT - GHC.Word.W8# ww3_s33d } of ww3_s33D { GHC.Word.W8# ww4_s33E - ww4_s33E } Core for gen (long): Rec { $s$wa_r3mi :: GHC.Prim.State# GHC.Prim.RealWorld - GHC.Prim.Addr# - GHC.Prim.Word# - GHC.Prim.Int# - GHC.Prim.Int# - GHC.Prim.Int# - GHC.Prim.ByteArray# - GHC.Types.Int - GHC.Types.Int - GHC.Types.Int - GHC.Prim.ByteArray# - GHC.Types.Int - GHC.Types.Int - GHC.Types.Int - (# GHC.Prim.State# GHC.Prim.RealWorld, (GHC.Word.Word32, GHC.Types.Int) #) [GlobalId] [Arity 14 NoCafRefs] $s$wa_r3mi = \ (sc_s3es :: GHC.Prim.State# GHC.Prim.RealWorld) (sc1_s3et :: GHC.Prim.Addr#) (sc2_s3eu :: GHC.Prim.Word#) (sc3_s3ev :: GHC.Prim.Int#) (sc4_s3ew :: GHC.Prim.Int#) (sc5_s3ex :: GHC.Prim.Int#) (sc6_s3ey :: GHC.Prim.ByteArray#) (sc7_s3ez :: GHC.Types.Int) (sc8_s3eA :: GHC.Types.Int) (sc9_s3eB :: GHC.Types.Int) (sc10_s3eC :: GHC.Prim.ByteArray#) (sc11_s3eD :: GHC.Types.Int) (sc12_s3eE :: GHC.Types.Int) (sc13_s3eF :: GHC.Types.Int) - let { m_s39b :: GHC.Types.Int [] m_s39b = GHC.Types.I# sc3_s3ev } in ((__scc {gen main:Main !} case sc5_s3ex of wild_B1 { __DEFAULT - case GHC.Prim.==# sc4_s3ew sc3_s3ev of wild1_X3F { GHC.Bool.False - (\ (eta_a2vm :: GHC.Prim.State# GHC.Prim.RealWorld) - let { ww_s33e :: GHC.Prim.Word# [] ww_s33e = GHC.Prim.remWord# (GHC.Prim.narrow32Word# (GHC.Prim.plusWord# (GHC.Prim.narrow32Word# (GHC.Prim.timesWord# __word 3877 sc2_s3eu)) __word 29573)) __word 139968 } in case $w$spick_r3k8 sc10_s3eC sc6_s3ey ww_s33e of ww1_s33i { __DEFAULT - case GHC.Prim.writeWord8OffAddr# @ GHC.Prim.RealWorld sc1_s3et sc4_s3ew ww1_s33i eta_a2vm of s21_a2wV { __DEFAULT - $s$wa_r3mi s21_a2wV sc1_s3et ww_s33e sc3_s3ev (GHC.Prim.+# sc4_s3ew 1) (GHC.Prim.+# wild_B1 1) sc6_s3ey sc7_s3ez sc8_s3eA sc9_s3eB sc10_s3eC sc11_s3eD sc12_s3eE sc13_s3eF } }) `cast` (sym
Re: [GHC] #3435: ghc-stage2 panic while compiling ghc-paths-0.1.0.5
#3435: ghc-stage2 panic while compiling ghc-paths-0.1.0.5 -+-- Reporter: jsch |Owner: simonmar Type: bug | Status: closed Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.11 Severity: normal| Resolution: fixed Keywords:| Difficulty: Unknown Testcase:| Os: Linux Architecture: x86 | -+-- Changes (by simonmar): * status: new = closed * resolution: = fixed Comment: Fixed: {{{ Fri Aug 21 16:47:37 BST 2009 Simon Marlow marlo...@gmail.com * Fix the interface-file incompatibility crash (#3435) }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3435#comment:4 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] #3398: Unicode output in GHC
#3398: Unicode output in GHC -+-- Reporter: simonmar |Owner: Type: bug | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.11 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase: 2816 | Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by simonmar): The `FilePath` issue is not a regression (i.e. it was broken in 6.10.x too), so fixing it is not a top priority. However, I really think we should address the general Unicode output issues I raised earlier in this ticket. Let's make a separate ticket for Unicode `FilePath` issues. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3398#comment:4 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] #3447: Class restrictions on type instances
#3447: Class restrictions on type instances -+-- Reporter: LysikovVV |Owner: Type: feature request | Status: new Priority: normal|Milestone: 6.14.1 Component: Compiler | Version: 6.10.4 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by simonpj): The right thing seems to be to make `BoolT (NotT a)` a superclass, thus: {{{ class BoolT (NotT a) = BoolT a where type NotT a }}} This is legal with `-XFlexibleContexts`. Perhaps you can see if that serves your purpose? Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3447#comment:2 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] #3455: Add a setting to change how Unicode encoding errors are handled
#3455: Add a setting to change how Unicode encoding errors are handled -+-- Reporter: judahj|Owner: Type: proposal | Status: new Priority: normal|Milestone: Not GHC Component: libraries/base| Version: 6.10.4 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by simonmar): It looks like the main question here is whether the `IOError` should be returned explicitly (as in your patch), or whether we should just catch the exception. All things being equal, catching the exception would be simpler, as it wouldn't require any changes in the codecs. Is there a reason why you didn't do it that way? Perhaps because you want to be sure that the exception is really an encoding error, and not some other kind of exception? If that's the case, then we should introduce a new exception for encoding errors (that's probably a good idea anyway). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3455#comment:2 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] #3458: Allocation where none should happen
#3458: Allocation where none should happen ---+ Reporter: guest |Owner: Type: bug | Status: new Priority: normal |Milestone: Component: Compiler| Version: 6.10.1 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | ---+ Comment (by guest): {{{ ll = 60, next :: Word32 - Word32 next s = (ia*s + ic) `rem` im ia = 3877 ic = 29573 im = 139968 }}} The whole program (changed to use IOUArray everywhere now, but the problem remains): {{{ {-# OPTIONS -O2 -funbox-strict-fields -fexcess-precision -fvia-C -optc-O3 -optc-ffast-math -optc-fomit-frame-pointer -optc-march=native -optc- mfpmath=sse -optc-msse3 #-} --- --- The Computer Language Benchmarks Game --- ---http://shootout.alioth.debian.org --- ---Fasta Benchmark --- --- Program by Rohan Lean --- import Control.Arrow import Control.Concurrent import Data.Array.Base import Data.Array.IO import Data.Array.Unboxed import Data.ByteString.Internal import Data.Word import System import System.IO main = do n - readIO . head = getArgs putStrLn ONE Homo sapiens alu write_alu (2*n) putStrLn TWO IUB ambiguity codes s - write iub (3*n) 42 putStrLn THREE Homo sapiens frequency write hom (5*n) s ll = 60 -- line length write_alu n = loop n = newListArray (1,bs) ul where cc = length alu_string `lcm` ll bs = cc + quot cc ll un = \s - (take ll s) ++ [0x0a] ++ un (drop ll s) ul = un $ cycle $ map c2w alu_string loop n b | cc = n = do hPutArray stdout b bs loop (n-cc) b | otherwise = do hPutArray stdout b (n + quot n ll) if rem n ll /= 0 then putChar '\n' else return () --- --- Constants for the linear congruential PRNG --- ia = 3877 ic = 29573 im = 139968 next :: Word32 - Word32 next s = (ia*s + ic) `rem` im skip n s = foldr id s $ replicate n next tn = 1 -- number of working threads lc = 250 -- threads prepare that many lines cc = lc*ll -- thus many characters bs = cc+lc -- buffersize write d n s = do go_1 - newMVar () done - newEmptyMVar spawn tn (convert d) n s go_1 go_1 done spawn 1 d n s go_k go_1 done = do a - newArray (1,bs) 0x0a forkIO $ writer d n a s go_k go_1 done takeMVar done spawn t d n s go_k go_1 done = do go_next - newEmptyMVar a - newArray (1,bs) 0x0a forkIO $ writer d n a s go_k go_next done spawn (t-1) d (max (n-cc) 0) (skip cc s) go_next go_1 done writer d 0 a s go go_next done = killThread = myThreadId writer d n a s go go_next done = do (t,br) - gen d 0 0 cr s a takeMVar go hPutArray stdout a br putMVar go_next () if n-cr == 0 then putMVar done t else return () let u = skip (cc*(tn-1)) t writer d n' a u go go_next done where cr = min n cc n' = max 0 (n-cc*tn) gen d r n m s a | r == ll = gen d 0 (n+1) (m+1) s a | n == m= do unsafeWrite a n 0x0a return (s, if r == 0 then m else m+1) | otherwise = do let t = next s unsafeWrite a n (pick d t) gen d (r+1) (n+1) m t a pick (c,p) r = loop 0 where loop i = if r unsafeAt p i then fromIntegral $ unsafeAt c i :: Word8 else loop (i+1) convert :: [(Char, Float)] - ((UArray Int Word32), (UArray Int Word32)) convert t = (a c, a p) where
Re: [GHC] #3447: Class restrictions on type instances
#3447: Class restrictions on type instances -+-- Reporter: LysikovVV |Owner: Type: feature request | Status: new Priority: normal|Milestone: 6.14.1 Component: Compiler | Version: 6.10.4 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by LysikovVV): Replying to [comment:2 simonpj]: This is legal with `-XFlexibleContexts`. Perhaps you can see if that serves your purpose? {{{ Cycle in class declarations (via superclasses): Bool.hs:(8,0)-(10,26): class (BoolT (NotT a)) = BoolT a where { type family NotT a; } }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3447#comment:3 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] #3458: Allocation where none should happen
#3458: Allocation where none should happen ---+ Reporter: guest |Owner: Type: bug | Status: new Priority: normal |Milestone: Component: Compiler| Version: 6.10.4 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | ---+ Changes (by guest): * version: 6.10.1 = 6.10.4 Comment: A few more notes: I could reproduce the bug with 6.10.4. When profiling, there is roughly ten times more allocation happening, which gets attributed to the program. Nevertheless, even when running a normal build the program allocates around 4.6GB here, and I don't see where all that allocation comes from. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3458#comment:3 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] #1409: Allow recursively dependent modules transparently (without .hs-boot or anything)
#1409: Allow recursively dependent modules transparently (without .hs-boot or anything) -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: normal|Milestone: _|_ Component: Compiler | Version: 6.10.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by explicitcall): * cc: explicitc...@gmail.com (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1409#comment:31 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] #3459: ghci 6.10.4 and 6.10.1 crash with a big list
#3459: ghci 6.10.4 and 6.10.1 crash with a big list +--- Reporter: joaoraf | Owner: Type: bug | Status: new Priority: normal | Component: GHCi Version: 6.10.4 | Severity: major Keywords: | Testcase: Os: Linux| Architecture: x86 +--- A have a haskell program with a big list of brazillian cities which crash ghci 6.10.4 with the following message (the same error occurred with 6.10.1): Prelude Data.ListTrie.Patricia.Map Data.ListTrie.Base.Map :l MakeMunicipios.hs [1 of 1] Compiling MakeMunicipios ( MakeMunicipios.hs, interpreted ) ghc: panic! (the 'impossible' happened) (GHC version 6.10.4 for i386-unknown-linux): linkBCO: = 64k insns in BCO Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3459 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] #3460: Can't use superclass when type coercions are involved
#3460: Can't use superclass when type coercions are involved -+-- Reporter: ryani | Owner: Type: bug | Status: new Priority: normal| Component: Compiler (Type checker) Version: 6.10.4| Severity: normal Keywords:| Testcase: Os: Unknown/Multiple | Architecture: Unknown/Multiple -+-- GHC 6.10.4. {{{ {-# LANGUAGE TypeFamilies, FlexibleContexts #-} module Coercion where class Nat n where toInt :: n - Int class (Nat (Arity f)) = Model f where type Arity f ok :: Model f = f - Arity f - Int ok _ n = toInt n bug :: (Model f, Arity f ~ n) = f - n - Int bug _ n = toInt n }}} I expect that (Model f) brings (Nat (Arity f)) into scope, and that (Arity f ~ n) means we can derive (Nat n). But the compiler disagrees. {{{ Coercion.hs:14:10: Could not deduce (Nat n) from the context (Arity f ~ n, Model f) arising from a use of `toInt' at Coercion.hs:14:10-16 Possible fix: add (Nat n) to the context of the type signature for `bug' In the expression: toInt n In the definition of `bug': bug _ n = toInt n }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3460 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
[Haskell] ANNOUNCE: OAuth library in haskell
Dear Haskellers, hoauth is a library which helps you to deal with oauth protocol. Currently it supports only consumer side applications, but there are plans to add service providers support in near future. The source code can be found at [darcs]: http://projects.bitforest.org/hoauth/ and now in hackage: http://hackage.haskell.org/package/hoauth If you have any questions, comments or criticism, please get in touch with me. I'll appreciate it very much, specially because there are so many things yet to learn. Thanks, PS: This is the first piece of code I produce in Haskell since I've start learning it few months ago. I must say it has been a joy since then. -- ~dsouza yahoo!im: paravinicius gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B 9ECE F88E 067F E891 651E ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] ANNOUNCE: graphtype — A simple tool to illustrate dependencies between Haskell types
While developing applications which deal with complex data it is crucial to know how exactly you manipulate this data. Haskell provides excellent tools for expressing a data scheme you work with: ADTs, `type` and `newtype` declarations, type classes and much more is hidden in rich Haskell's type system. Obviously, when types of data in your domain you work with grow — all declarations grow, and it becomes hard to grasp all dependencies, to change them and to remove them deliberately. graphtype was developed to visualise type declarations in you Haskell source files. It produces .dot-file for subsequent processing with graphviz. Results for example file bundled with graphtype: http://i.piccy.info/i4/00/90/bfa07290012c2d3b455696bdaa86.png To play with it, you can use hackage: http://hackage.haskell.org/package/graphtype or hack some code: http://github.com/explicitcall/graphtype Visualisation of dependencies in complex type class hierarchies is still on the way. It isn't obvious how do to this nicely, as in most cases type class declarations are imported from other libraries, and you don't always have source files for them. Anyway, graphtype is fairly usable. Leave here your questions, suggestions and have fun looking at type dependencies in your code. WBR, Max ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] ANN: rss2irc 0.3 released
rss2irc is an irc bot created by Don Stewart to watch rss feeds and announce new items on irc. I have been tweaking and testing it for a while, and have taken up the maintainer reins. I'm happy to announce release 0.3, with: - reliable http networking - irc flood protection - better error handling reporting - extensive debugging output - Atom support - more useful defaults (enter channel silently, hide email addresses etc.) - precise control of irc output, including regexp rewrites - installable on mac osx Feedback and patches welcome. I am currently using it to run a number of announce-bots on freenode, including hackagebot and darcscommitbot. (A tip: if you experiment, avoid joining the irc server too frequently; once per minute may be ok.) home: http://hackage.haskell.org/package/rss2irc darcs repo: http://joyful.com/darcsweb/darcsweb.cgi?r=rss2irc -Simon ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] ANNOUNCE: jhc 0.7.1
Hi, I am happy to announce the jhc optimizing haskell compiler version 0.7.1. Information on installing jhc is here: http://repetae.net/computer/jhc/building.shtml And the Main page is here: http://repetae.net/computer/jhc There have been a lot of changes since the last public release, Some notable ones are: * The use of a general compiler cache by default rather than object files. This means work done by jhc is shared between projects, jhc uses cryptographic hashes internally to never compile the same piece of code more than once. This has numerous benefits, a notable one being speed. * Reworked library support. Jhc libraries are now much more general, when linking only the bits needed are loaded from the hl file, libraries are allowed to re-export modules from other libraries, making versioning or providing multiple interfaces to the same functionality a lot simpler. Library conflicts are 'lazy', like ambiguity errors now. * Updated Manual, clearer build instructions * Support for writing pure C libraries in Haskell. * numerous library updates, filled out many IO routines that were stubs before * Smart progress meters when compiler for a better user experience * performs all typechecking before compilation, for a faster edit-compile loop when writing code with jhc. * various bug fixes * Cross Compilation improvements, for instance you can compile for windows transparently on a linux box. Or for an embedded target that is independent of the host. * Better Mac OSX Support, as both a host and target. If you are wondering about the large version number bump since the last release, It is because several versions were released only internally to the jhc list for testing. If you are interested in jhc, join the list at: http://www.haskell.org/mailman/listinfo/jhc John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Re: [Haskell-cafe] ANNOUNCE: jhc 0.7.1
Hi John, On Mon, Aug 24, 2009 at 11:13 PM, John Meachamj...@repetae.net wrote: Hi, I am happy to announce the jhc optimizing haskell compiler version 0.7.1. Information on installing jhc is here: http://repetae.net/computer/jhc/building.shtml And the Main page is here: http://repetae.net/computer/jhc Cheers! Thanks for the great work. It took me 5 minutes between downloading the tarball and compiling hello world, and this is my first time. There should be no excuses for not giving jhc a whirl. : ) Paulo ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell-cafe] Functional Dependencies and multiparameter typeclasses
Dear Haskellers, I am using multi parameter typeclasses to represent images consisting of pixels (e.g. bitmap images). {-# OPTIONS_GHC -XMultiParamTypeClasses #-} module Bitmap where -- | a pixel could be a Word8 (e.g. a graysclale image) -- | or a 3-tuple for RGB images class Pixel p where pixel related functions go here -- | an image could be a UArray or a list of lists of pixels class Pixel p = Image a p where width :: a - Int height :: a - Int dims :: a - (Int, Int) dims img = (height img, width img) If I try to load this module into ghci I get: Could not deduce (Image a p) from the context (Image a p2) arising from a use of 'height' at . and Could not deduce (Image a p1) from the context (Image a p2) arising from a use of 'width' at .. where both errors originate from the 'dims' function. Eventually I figured out that I could remedy the situattion by using functional dependencies like this: class Pixel p = Image a p | a - p where ... However, I do not really understand the cause of the original problem. Why do I need the functional dependency to make this work ? Any help is appreciated. Thanks Harald. Ce courriel et les documents qui y sont attaches peuvent contenir des informations confidentielles. Si vous n'etes pas le destinataire escompte, merci d'en informer l'expediteur immediatement et de detruire ce courriel ainsi que tous les documents attaches de votre systeme informatique. Toute divulgation, distribution ou copie du present courriel et des documents attaches sans autorisation prealable de son emetteur est interdite. This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, please advise the sender immediately and delete this e-mail and all attached documents from your computer system. Any unauthorised disclosure, distribution or copying hereof is prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional Dependencies and multiparameter typeclasses
However, I do not really understand the cause of the original problem. Why do I need the functional dependency to make this work ? Suppose you have an instance: instance Pixel MyPixel where... instance Image MyImage MyPixel where width i = countPixels i ... And somebody (not necessarily you) makes another instance: instance Pixel CustomPixel where... instance Image MyImage CustomPixel where width i = 0 ... Now, take any image im :: MyImage Then you'd expect that width im :: Int But now there are TWO implementations of width :: MyImage - Int and no way for compiler to figure out which one to use. GHC sort of foresees this problem. By adding a functional dependency you instruct it to forbid the second declaration, when the first one is present, thus removing the problem. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional Dependencies and multiparametertypeclasses
Thanks for the quick response. Your explanation is so much clearer than ghc's error messages :-)) Harald. |-+-- | | Miguel Mitrofanov | | | miguelim...@yandex| | | .ru | | | | | | | | | 24.08.2009 13:29 | | | Delivered date:| | | 24.08.2009 13:31 | | | | |-+-- | | | | To: Harald ROTTER harald.rot...@sagem.com | | cc: haskell-cafe@haskell.org | | Subject: Re: [Haskell-cafe] Functional Dependencies and multiparameter typeclasses| | However, I do not really understand the cause of the original problem. Why do I need the functional dependency to make this work ? Suppose you have an instance: instance Pixel MyPixel where... instance Image MyImage MyPixel where width i = countPixels i ... And somebody (not necessarily you) makes another instance: instance Pixel CustomPixel where... instance Image MyImage CustomPixel where width i = 0 ... Now, take any image im :: MyImage Then you'd expect that width im :: Int But now there are TWO implementations of width :: MyImage - Int and no way for compiler to figure out which one to use. GHC sort of foresees this problem. By adding a functional dependency you instruct it to forbid the second declaration, when the first one is present, thus removing the problem. Ce courriel et les documents qui y sont attaches peuvent contenir des informations confidentielles. Si vous n'etes pas le destinataire escompte, merci d'en informer l'expediteur immediatement et de detruire ce courriel ainsi que tous les documents attaches de votre systeme informatique. Toute divulgation, distribution ou copie du present courriel et des documents attaches sans autorisation prealable de son emetteur est interdite. This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, please advise the sender immediately and delete this e-mail and all attached documents from your computer system. Any unauthorised disclosure, distribution or copying hereof is prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: OAuth library in haskell
Dear Haskellers, hoauth is a library which helps you to deal with oauth protocol. Currently it supports only consumer side applications, but there are plans to add service providers support in near future. The source code can be found at [darcs]: http://projects.bitforest.org/hoauth/ and now in hackage: http://hackage.haskell.org/package/hoauth If you have any questions, comments or criticism, please get in touch with me. I'll appreciate it very much, specially because there are so many things yet to learn. Thanks, PS: This is the first piece of code I produce in Haskell since I've start learning it few months ago. I must say it has been a joy since then. -- ~dsouza yahoo!im: paravinicius gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B 9ECE F88E 067F E891 651E ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: graphtype — A simple tool to illustrate dependencies between Haskell types
While developing applications which deal with complex data it is crucial to know how exactly you manipulate this data. Haskell provides excellent tools for expressing a data scheme you work with: ADTs, `type` and `newtype` declarations, type classes and much more is hidden in rich Haskell's type system. Obviously, when types of data in your domain you work with grow — all declarations grow, and it becomes hard to grasp all dependencies, to change them and to remove them deliberately. graphtype was developed to visualise type declarations in you Haskell source files. It produces .dot-file for subsequent processing with graphviz. Results for example file bundled with graphtype: http://i.piccy.info/i4/00/90/bfa07290012c2d3b455696bdaa86.png To play with it, you can use hackage: http://hackage.haskell.org/package/graphtype or hack some code: http://github.com/explicitcall/graphtype Visualisation of dependencies in complex type class hierarchies is still on the way. It isn't obvious how do to this nicely, as in most cases type class declarations are imported from other libraries, and you don't always have source files for them. Anyway, graphtype is fairly usable. Leave here your questions, suggestions and have fun looking at type dependencies in your code. WBR, Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional Dependencies and multiparameter typeclasses
Hello Harald, Monday, August 24, 2009, 3:17:28 PM, you wrote: class Pixel p where -- | an image could be a UArray or a list of lists of pixels class Pixel p = Image a p where read http://haskell.org/haskellwiki/OOP_vs_type_classes here you say that Image is a particular case of Pixel :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [ann] formlets 0.6
Hey everyone, I wanted to let you know that the formlets team has released a new version of the formlets [1] on hackage, a library to build type-safe, composable web forms. Most notably, Mightybyte and I worked on the massInput functionality, which is now ready for use! Mightybyte has an excellent article [2] on how to use the massInput to build dynamic forms on the client side. If you're building web apps with Haskell, make sure you check it out. -chris [1]: http://hackage.haskell.org/package/formlets [2]: http://softwaresimply.blogspot.com/2009/08/dynamic-list-formlets-in-haskell.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Gtk2Hs drag and drop
Hi, have somebody used drag and drop feature of Gtk2hs? I can't find any tutorial or demo. I'm using only the documentation but I think I'm missing something. Can anyone give me an example? Thanks in forward! Fero ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problem building encoding-0.6.0: missing Data.CharMap.Builder
Hi, I am trying to install the encoding-0.6.0 package, but it complains that that package Data.CharMap.Builder is missing. I could not find any reference to that package anywhere on the web. Does anyone know where I can find it or a workaround? Thanks, João Rafael cabal install encoding Resolving dependencies... /tmp/encoding-0.6.08632/encoding-0.6.0/Data/Encoding/Preprocessor/XMLMappingBuilder.hs:11:7: Could not find module `Data.CharMap.Builder': Use -v to see a list of the files searched for. cabal: Error: some packages failed to install: encoding-0.6.0 failed during the configure step. The exception was: exit: ExitFailure 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Converting typeset mathematics into Haskell ?
Sometimes the synchronicity of events is eery. Incidentally I have just written a proposal for just such a project. You can have a look at it at http://www-ps.informatik.uni-kiel.de/~bbr/WebOfProofs.html Although not directly mentioned in the proposal, there will be a lot of Converting typeset mathematics into Haskell going on. Kind regards Bernd PS: And just in case I did it wrong again; this is the message I wanted to reply to http://www.haskell.org/pipermail/haskell-cafe/2009-August/065572.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Linking problem with GHCi
With a specific package (bindings-common, with the latest version in hackage) if I ask GHCi to read it I get: ghc-6.8.2: /home/mauricio/lib/bindings-common-0.2.5/ghc-6.8.2/HSbindings-common-0.2.5.o: unknown symbol `atexit' If I build a library or executable cabal package depending on it, I have no problems. Also, if I remove that 'atexit' wrap from 'bindings-common' I don't get this ghci error message anymore. Why would just this 'atexit' function be a problem? It's wrap does work well, and I can use it from a Haskell program through bindings-common (although not in ghci, of course). This happens at least in ghc-6.8.2 and 6.10.3. Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: rss2irc 0.3 released
rss2irc is an irc bot created by Don Stewart to watch rss feeds and announce new items on irc. I have been tweaking and testing it for a while, and have taken up the maintainer reins. I'm happy to announce release 0.3, with: - reliable http networking - irc flood protection - better error handling reporting - extensive debugging output - Atom support - more useful defaults (enter channel silently, hide email addresses etc.) - precise control of irc output, including regexp rewrites - installable on mac osx Feedback and patches welcome. I am currently using it to run a number of announce-bots on freenode, including hackagebot and darcscommitbot. (A tip: if you experiment, avoid joining the irc server too frequently; once per minute may be ok.) home: http://hackage.haskell.org/package/rss2irc darcs repo: http://joyful.com/darcsweb/darcsweb.cgi?r=rss2irc -Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] rotate image
Hello, I already studied the references of gtk2hs for hours, as well as searched in the web, but didn't found any working solution. The problem is to load an image, a png with alpha channel, rotate it e.g. 10 degree, and show it on the screen, basically as when it would be shown with imageNewFromFile with transparency. Thanks in advance for your help. -- Best regards H. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] rotate image
You could use Cairo. Load the image to a surface, then rotate the surface 10 degrees and paint it. Alternately, in Hieroglyph: renderToPNG w h image.png $ rotate 10 image{ filename='whatever.png' } On Mon, Aug 24, 2009 at 3:57 PM, hh._h._...@hotmail.com wrote: Hello, I already studied the references of gtk2hs for hours, as well as searched in the web, but didn't found any working solution. The problem is to load an image, a png with alpha channel, rotate it e.g. 10 degree, and show it on the screen, basically as when it would be shown with imageNewFromFile with transparency. Thanks in advance for your help. -- Best regards H. ___ 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] oauth in haskell - reviewers?
I recommend Learn you a Haskell for great good: http://learnyouahaskell.com/functors-applicative-functors-and-monoids#applicative-functors On Sun, Aug 23, 2009 at 12:25 PM, Diego Souzadso...@bitforest.org wrote: A quick search pointed me to this: http://www.soi.city.ac.uk/~ross/papers/Applicative.html Is there any other resources you would suggest me to read? Thanks at lot, -- ~dsouza yahoo!im: paravinicius gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B 9ECE F88E 067F E891 651E ___ 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] rotate image
Hello, You could use Cairo. Load the image to a surface, then rotate the surface 10 degrees and paint it. The first steps aren’t problematic, but how can I paint it - in which widget - so that the background is transparent, with drawingArea it doesn’t seem to work. -- best regards H. -- View this message in context: http://www.nabble.com/rotate-image-tp25122912p25123653.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] oauth in haskell - reviewers?
I notice hoauth is packaged as LGPL. Since we use static linking in GHC, this makes it in practice GPL. Is that the intent? -- Don wei.hoo: I recommend Learn you a Haskell for great good: http://learnyouahaskell.com/functors-applicative-functors-and-monoids#applicative-functors On Sun, Aug 23, 2009 at 12:25 PM, Diego Souzadso...@bitforest.org wrote: A quick search pointed me to this: http://www.soi.city.ac.uk/~ross/papers/Applicative.html Is there any other resources you would suggest me to read? Thanks at lot, -- ~dsouza yahoo!im: paravinicius gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B 9ECE F88E 067F E891 651E ___ 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] Is logBase right?
I don't know if anyone actually answered the question you didn't ask, but you can always improve an inaccurate guess when you need to. A limit will always exist, and should be unique (independent of the initial guess), assuming (+) and (*) are well-conditioned. In practice, a single first-order Taylor step should be enough: logBase' :: Double - Double - Double logBase' b y = if b == 0.0 then 1.0 else improve x0 where bLogInv = 1.0 / log(b) f x = x + (1.0-b**x/y) * bLogInv -- First step is enough, if we guess smartly improve = f x0 = log(y) * bLogInv -- or use the limit from any initial guess -- improve x = let y = f x in if y == x then y else improve y -- x0 = 0.0 Dan Roberto wrote: Hi, There is a mistake is logBase: $ ghci GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Prelude logBase 10 10 1.0 Prelude logBase 10 100 2.0 Prelude logBase 10 1000 2.9996 --- rrgg! Prelude logBase 10 1 4.0 My host is a Debian GNU/Linux 5.0.2 (lenny) with the following GHC packages: ii ghc6 6.10.4-1 ii ghc6-doc 6.10.4-1 ii libghc6-mtl-dev 1.1.0.2-7+b1 ii libghc6-utf8-string-dev 0.3.5-1+b1 ii libghc6-x11-dev 1.4.5-6 rc libghc6-x11-doc 1.4.2-1 ii libghc6-x11-xft-dev 0.3-3+b3 ii libghc6-xmonad-contrib-dev 0.8.1-3+b3 rc libghc6-xmonad-contrib-doc 0.8-2 ii libghc6-xmonad-dev 0.8.1-5 Regards! ___ 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] How to convert a list to a vector encoding its length in its type?
unsafeCoerce is ugly and I wouldn't count on that working properly. Here's a real solution: {-# LANGUAGE GADTs, RankNTypes, TypeFamilies, ScopedTypeVariables, FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} module LevMar where import Data.Maybe (fromJust) Type-level number scaffold: data Z = Z newtype S n = S n class Nat n where caseNat :: forall r. n - (n ~ Z = r) - (forall p. (n ~ S p, Nat p) = p - r) - r instance Nat Z where caseNat _ z _ = z instance Nat n = Nat (S n) where caseNat (S n) _ s = s n induction :: forall p n. Nat n = n - p Z - (forall x. Nat x = p x - p (S x)) - p n induction n z s = caseNat n isZ isS where isZ :: n ~ Z = p n isZ = z isS :: forall x. (n ~ S x, Nat x) = x - p n isS x = s (induction x z s) newtype Witness x = Witness { unWitness :: x } witnessNat :: forall n. Nat n = n witnessNat = theWitness where theWitness = unWitness $ induction (undefined `asTypeOf` theWitness) (Witness Z) (Witness . S . unWitness) Sized list type: data SizedList a n where Nil :: SizedList a Z Cons :: a - SizedList a n - SizedList a (S n) infixr 2 `Cons` toList. Your implementation is simpler, but this gives you an idea of how to use induction to generate a function that you need. newtype ToList a n = ToList { unToList :: SizedList a n - [a] } toList :: forall a n. Nat n = SizedList a n - [a] toList = unToList $ induction (witnessNat :: n) (ToList tl0) (ToList . tlS . unToList) where tl0 :: SizedList a Z - [a] tl0 Nil = [] tlS :: forall x. Nat x = (SizedList a x - [a]) - SizedList a (S x) - [a] tlS f (Cons x xs) = x : f xs fromList. Here we return a Maybe value to represent that the list might not be the right size. newtype FromList a n = FromList { unFromList :: [a] - Maybe (SizedList a n) } fromList :: forall a n. Nat n = [a] - Maybe (SizedList a n) fromList = unFromList $ induction (witnessNat :: n) (FromList fl0) (FromList . flS . unFromList) where fl0 [] = Just Nil fl0 _ = Nothing flS k [] = Nothing flS k (x:xs) = fmap (Cons x) $ k xs Model for your levMar functions class (Nat (Arity f)) = Model f where type Arity f app :: f - SizedList Double (Arity f) - Double instance Model Double where type Arity Double = Z app v Nil = v instance Model f = Model (Double - f) where type Arity (Double - f) = S (Arity f) app f (Cons v vs) = app (f v) vs And the levmar implementations: levmarML :: (a - [Double] - Double) - [Double] - [(a,Double)] - [Double] levmarML f inits samples = inits levmarHL :: (Model f) = (a - f) - SizedList Double (Arity f) - [(a, Double)] - SizedList Double (Arity f) levmarHL f inits samples = fromJust $ fromList $ levmarML (\a - app (f a) . fromJust . fromList) (toList inits) samples We rely on levmarML only calling the passed-in function with a correctly-sized list, and returning a similarily correctly-sized list. That assumption is made explicit with the calls to fromJust. testModel :: Double - Double - Double - Double testModel n x y = x*y - n*n test = levmarHL testModel (1 `Cons` 2 `Cons` Nil) [(3, 10), (4, 20)] *LevMar :t test test :: SizedList Double (Arity (Double - Double - Double)) *LevMar toList test [1.0, 2.0] -- ryan On Fri, Aug 21, 2009 at 11:50 AM, Bas van Dijkv.dijk@gmail.com wrote: Thanks for all the advice. I have this so far. Unfortunately I have to use unsafeCoerce: - {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} module LevMar where import Unsafe.Coerce levmarML :: (a - [Double] - Double) - [Double] - [(a, Double)] - [Double] levmarML model initParams samples = initParams data Z data S n data Nat n where Zero :: Nat Z Succ :: Nat n - Nat (S n) data Vector a n where Nil :: Vector a Z (:*:) :: a - Vector a n - Vector a (S n) infixr :*: instance Show a = Show (Vector a n) where show Nil = Nil show (x :*: xs) = show x ++ :*: ++ show xs toList :: Vector b n - [b] toList Nil = [] toList (x :*: xs) = x : toList xs listVec :: [a] - (forall n. Vector a n - t) - t listVec [] f = f Nil listVec (x : xs) f = listVec xs (\ys - f (x :*: ys)) type family Replicate n (a :: * - *) b :: * type instance Replicate (S x) a b = a (Replicate x a b) type instance Replicate Z a b = b type Function n a b = Replicate n ((-) a) b ($*) :: Function n a a - Vector a n - a f $* Nil = f f $* (x :*: xs) = f x $* xs levmarHL :: (a - Function n Double Double) - Vector Double n - [(a, Double)] - Vector Double n levmarHL model initParams samples = listVec (levmarML (\x params - listVec params $ \v - unsafeCoerce (model x) $* v) (toList initParams) samples)
[Haskell-cafe] Re: Linking problem with GHCi
With a specific package (bindings-common, with the latest version in hackage) if I ask GHCi to read it I get: ghc-6.8.2: /home/mauricio/lib/bindings-common-0.2.5/ghc-6.8.2/HSbindings-common-0.2.5.o: unknown symbol `atexit' If I build a library or executable cabal package depending on it, I have no problems. Also, if I remove that 'atexit' wrap from 'bindings-common' I don't get this ghci error message anymore. This is actually not specific to that package. Attached is a darcs patch to a package where the only exported module contains just a wrapped 'atexit'. Thanks, Maurício Mon Aug 24 19:24:20 BRT 2009 mauricio.antu...@gmail.com * All New patches: [All mauricio.antu...@gmail.com**20090824222420 Ignore-this: e09fe2a2596b6e041c7297efcaad55cb ] adddir ./BaseName addfile ./BaseName/JustAtexit.hs hunk ./BaseName/JustAtexit.hs 1 +module BaseName.JustAtexit where +import Foreign +import Foreign.C + +foreign import ccall atexit :: FunPtr (IO ()) - IO CInt + + addfile ./Setup.hs hunk ./Setup.hs 1 +#!/usr/bin/env runhaskell + +module Main (main) where +import Distribution.Simple + +main = defaultMain addfile ./teste.cabal hunk ./teste.cabal 1 +cabal-version: = 1.2.3 +name: teste +version: 0.0.1 +synopsis: + Test +description: + Test +version: 1 +license: BSD3 +build-type: Simple +library + hs-source-dirs: . + extensions: +ForeignFunctionInterface + build-depends: base =3 5 + exposed-modules: +BaseName.JustAtexit Context: Patch bundle hash: b4c77eef776e4e5c0b7266156fe638c82a6ab1da ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: rotate image
Hello, You could use Cairo. Load the image to a surface, then rotate the surface 10 degrees and paint it. The first steps aren’t problematic, but how can I paint it - in which widget - so that the background is transparent, with drawingArea it doesn't seem to work. -- best regards H. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] oauth in haskell - reviewers?
Hi Don, no, not really, I completely missed that point. But if that is the case, I presume there is no difference in using other licenses, like BSD3. Is that the case? Thanks, On Mon, Aug 24, 2009 at 02:24:09PM -0700, Don Stewart wrote: I notice hoauth is packaged as LGPL. Since we use static linking in GHC, this makes it in practice GPL. Is that the intent? -- ~dsouza yahoo!im: paravinicius gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B 9ECE F88E 067F E891 651E ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to convert a list to a vector encoding its length in its type?
On Tue, Aug 25, 2009 at 12:07 AM, Ryan Ingramryani.s...@gmail.com wrote: unsafeCoerce is ugly and I wouldn't count on that working properly. Here's a real solution: ... Thanks very much! I'm beginning to understand the code. The only thing I don't understand is why you need: newtype Witness x = Witness { unWitness :: x } witnessNat :: forall n. Nat n = n witnessNat = theWitness where theWitness = unWitness $ induction (undefined `asTypeOf` theWitness) (Witness Z) (Witness . S . unWitness) I understand that 'witnessNat' is a overloaded value-level generator for Nats. So for example: 'witnessNat :: S (S (S Z))' returns the value: 'S (S (S Z))'. Then you use it in the implementation of 'toList' and 'fromList': toList = ... induction (witnessNat :: n) ... fromList = ... induction (witnessNat :: n) ... I guess so that 'induction' will then receive the right 'Nat' _value_. However the following also works: toList = ... induction (undefined :: n) ... fromList = ... induction (undefined :: n) ... Indeed, 'witnessNat' itself is implemented this way: witnessNat = theWitness where theWitness = ... induction (undefined `asTypeOf` theWitness) ... So the 'n' in 'induction n' is just a type carrying parameter i.e. it doesn't need to have a run-time representation. Al dough it looks like that a case analysis on 'n' is made at run-time in: instance Nat n = Nat (S n) where caseNat (S n) _ s = s n But I guess that is desugared away because 'S' is implemented as a newtype: newtype S n = S n Indeed, when I make an actual datatype of it then 'witnessNat :: S (S (S Z))' will crash with *** Exception: Prelude.undefined. Again, thanks very much for this! Do you mind if I use this code in the levmar package (soon to be released on hackage)? regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: rotate image
ahh, you want to paint against the desktop, then, yes? That requires compositing, and I'm not sure there's a way to do that with Gtk directly. Probably easier with X and OpenGL. Needs more of a Gnome expert than me. On Mon, Aug 24, 2009 at 6:34 PM, hh._h._...@hotmail.com wrote: Hello, You could use Cairo. Load the image to a surface, then rotate the surface 10 degrees and paint it. The first steps aren’t problematic, but how can I paint it - in which widget - so that the background is transparent, with drawingArea it doesn't seem to work. -- best regards H. ___ 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: rotate image
Hello, I want to paint in some widget, but this will be in front of some background, so the bg should be transparent. At the moment it looks something like this (where it isn't the case): -- drawA - drawingAreaNew widgetSetSizeRequest drawA 30 30 fixedPut fBox drawA (400,400) imgAt - imageSurfaceCreateFromPNG some.png let drawC = do dw - widgetGetDrawWindow drawA drawWindowClear dw renderWithDrawable dw $ do translate 9 9 rotate 0.3 translate (-9) (-9) setSourceSurface imgAt 0 0 paint onExpose drawA (const $ drawC return True) -- -- best regards H. From: jefferson.r.he...@gmail.com Date: Mon, 24 Aug 2009 19:40:46 -0400 Subject: Re: [Haskell-cafe] Re: rotate image To: h._h._...@hotmail.com CC: haskell-cafe@haskell.org ahh, you want to paint against the desktop, then, yes? That requires compositing, and I'm not sure there's a way to do that with Gtk directly. Probably easier with X and OpenGL. Needs more of a Gnome expert than me. _ Hol dir 30 kostenlose Emoticons für deinen Windows Live Messenger http://www.livemessenger-emoticons.com/funfamily/de-at/___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unifcation and matching in Abelian groups
... Haskell is old and has the optional offset rule: do { prob - getLine ; test prob ; main} It's interesting to see people put semicolons at the begining of a line of code. In 1970s, people used to draw lines on printouts of Ada and Pascal code to connect the begins with the ends. My first publication Ramsdell, J. D., Prettyprinting Structured Programs with Connector Lines, ACM SIGPLAN Notices, Vol. 14, No. 9, p. 74, September 1979 suggested prettyprinting Ada and Pascal programs with the semicolons at the begining of the lines and use them as the connector lines. Thus a prettyprinted Ada program looked like: package Mine is ... begin ; while i Integer'Last loop ; ;Print (i) ; end loop; end Mine; It didn't work quite as well in Pascal, because semicolon was a statement separator instead of a statement terminator. In those day, procedures tended to large and deeply nested because procedure invocation was expensive. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Unifcation and matching in Abelian groups
Hello John, Tuesday, August 25, 2009, 4:51:16 AM, you wrote: In those day, procedures tended to large and deeply nested because procedure invocation was expensive. interesting story. in 80s, virtual method call was expensive. now lazy evaluation is expensive. what's next? :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: jhc 0.7.1
Hi, I am happy to announce the jhc optimizing haskell compiler version 0.7.1. Information on installing jhc is here: http://repetae.net/computer/jhc/building.shtml And the Main page is here: http://repetae.net/computer/jhc There have been a lot of changes since the last public release, Some notable ones are: * The use of a general compiler cache by default rather than object files. This means work done by jhc is shared between projects, jhc uses cryptographic hashes internally to never compile the same piece of code more than once. This has numerous benefits, a notable one being speed. * Reworked library support. Jhc libraries are now much more general, when linking only the bits needed are loaded from the hl file, libraries are allowed to re-export modules from other libraries, making versioning or providing multiple interfaces to the same functionality a lot simpler. Library conflicts are 'lazy', like ambiguity errors now. * Updated Manual, clearer build instructions * Support for writing pure C libraries in Haskell. * numerous library updates, filled out many IO routines that were stubs before * Smart progress meters when compiler for a better user experience * performs all typechecking before compilation, for a faster edit-compile loop when writing code with jhc. * various bug fixes * Cross Compilation improvements, for instance you can compile for windows transparently on a linux box. Or for an embedded target that is independent of the host. * Better Mac OSX Support, as both a host and target. If you are wondering about the large version number bump since the last release, It is because several versions were released only internally to the jhc list for testing. If you are interested in jhc, join the list at: http://www.haskell.org/mailman/listinfo/jhc John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: jhc 0.7.1
Hi John, On Mon, Aug 24, 2009 at 11:13 PM, John Meachamj...@repetae.net wrote: Hi, I am happy to announce the jhc optimizing haskell compiler version 0.7.1. Information on installing jhc is here: http://repetae.net/computer/jhc/building.shtml And the Main page is here: http://repetae.net/computer/jhc Cheers! Thanks for the great work. It took me 5 minutes between downloading the tarball and compiling hello world, and this is my first time. There should be no excuses for not giving jhc a whirl. : ) Paulo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: graphtype — A simple tool to illustrate dependencies between Haskell types
2009/8/24 Max Desyatov explicitc...@googlemail.com: graphtype was developed to visualise type declarations in you Haskell source files. It produces .dot-file for subsequent processing with graphviz. Anyway, graphtype is fairly usable. Leave here your questions, suggestions and have fun looking at type dependencies in your code. Neat. You could probably get some leverage from the GHC API for reading .hi files to find out information about imported types. It looks to me like you generate one image file for the whole graph. It could get quite big. I think dot supports hyperlinks, and so do some image formats (SVG I believe). Maybe you could split it up into pieces with hyperlinks between them. Browser support for SVG appears to be getting better these days. I've sometimes mused about the idea of graphing the static function call graph of programs and annotating arcs with type information. For that the GHC API would be the way to go (might need to do a little type reconstruction along the way to figure out the concrete types at which polymorphic functions are used.) Cheers, Bernie. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe