#apache #archlinux #asterisk #centos #debian #gentoo #haskell #kde #kubuntu #lisp #math #mysql #perl #python #ruby-lang #rubyonrails #suse #ubuntu #vim #wikipedia 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Top Prev 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 Next
#haskell
<sorear> fasta: notably, ghci has -fextended-default-rules on by default, so (show []) is well typed for instance
<fasta> sorear: the problem is that a type variable is narrowed to (). I hope I can get the same options in some way.
<sorear> Eighty: yech, look at http://darcs.haskell.org/ghc-6.6/packages/base/GHC/List.lhs halfway down /#ifdef USE_REPORT_PRELUDE
<fasta> set_flow =
<fasta> (\ep g f -> Mut.modify_edge_label (\l -> l{flow=f}) ep g) :: (Gr g edge_position EKLabel) => edge_position -> g a EKLabel -> Int -> g a EKLabel
<sorear> #else /* Hack away! */
<fasta> In fact when I ask for the type of set_flow, I get a _different_ type!
<fasta> I completely gave the type as you can see.
<fasta> (This is ghci-6.6)
<fasta> set_flow :: forall (g :: * -> * -> *) a. (Gr g () EKLabel) => () -> g a EKLabel -> Int -> g a EKLabel
<fasta> This is the type I get when I do :t set_flow
<robert_|_> sorear: I now have a .hc file. Is it possible to compile that with gcc?
<sjanssen> sorear: the "Hack away!" phrase is my favorite
<fasta> sjanssen: you any idea?
<sjanssen> you find it all over the base package
<Eighty> sorear: USE_REPORT_PRELUDE isn't defined usually i guess? ghc uses some optimized variant?
<sorear> robert_|_: yes, but you might want to run ghc -v first to see and -D options ; aslo you may need to run the mangler manually
<Lemmih> fasta: You're hitting the monomorphism restriction.
<sjanssen> Eighty: USE_REPORT_PRELUDE isn't really used anymore, it's mainly for documentation purposes nowadays
<robert_|_> sorear: ok thanx...
<fasta> Lemmih: I also tried to put the arguments on the LHS
<fasta> Lemmih: that should get rid of the monomorphism restriction, right?
<sorear> Eighty: also pay note to the fact that with -O take (10^7) [0..] can fuse, but take' can't.
<fasta> Lemmih: And, don't you think that it's odd that it completely ignores the type I gave it?
<Eighty> sorear: what is fusing?
<Eighty> ghc optimizes it to [0..10^7-1] because it knows what take does?
<sjanssen> Eighty: it means the intermediate list between the generator and the consumer isn't produced at all
<sorear> Eighty: shortcut deforestatation. it doesn't quite get optimized to that (I think) but the intermediate list can be turned into a lloop
<sjanssen> the code generated will be very similar to the code generated for [0 .. 10^7 - 1]
<fasta> Lemmih: How can I convince ghci to give the right type?
<Lemmih> fasta: Give it a type signature.
<Eighty> why doesn't it do it with take'?
<fasta> Lemmih: on the top-level, you mean?
<ddarius> @ft f::((a -> b -> b) -> b -> b) -> [a] -> [a]
<lambdabot> There was an error in the type: (line 1, column 4):
<lambdabot> unexpected type constructor 'Not' (this type constructor is not declared)
<nrb23> :t spac
<lambdabot> Not in scope: `spac'
<nrb23> ?hoogle spac
<lambdabot> Text.Html.spaceHtml :: Html
<lambdabot> Text.PrettyPrint.HughesPJ.space :: Doc
<lambdabot> Text.ParserCombinators.Parsec.Char.space :: CharParser st Char
<fasta> Lemmih: but shouldn't -fno-monomorphism-restriction solve that problem?
<ejt> hi
<sorear> hello
<ejt> in case anyone is interested; I've been teaching myself Haskell by working on the puzzles in the 'programming challenges' book. About 20 programs are available on lambda-software.com
<Korollary> I too used some of those problems (from http://acm.uva.es/problemset/) when I first learned haskell.
<lambdabot> Title: online-judge.uva.es - PROBLEM SET ARCHIVE
<TomMD> ejt: what is your opinion thus far?
<ejt> of Haskell ? I love it
Previous Page Next Page