Re: Compiling ghcjs
On 27/06/2012 13:24, Nathan Hüsken wrote: I hope this is the correct list to ask this question. I am trying to compile the ghcjs compiler. I am on ubuntu 12.04 and have ghc-7.4.1 installed (via apt-get). I am following the instruction I found here: https://github.com/ghcjs/ghcjs The first trouble comes with "git pull ghcjs". I get: remote: Counting objects: 42, done. remote: Compressing objects: 100% (9/9), done. remote: Total 26 (delta 22), reused 21 (delta 17) Unpacking objects: 100% (26/26), done. From github.com:ghcjs/packages-Cabal * [new branch] encoding -> ghcjs/encoding * [new branch] ghc-7.2-> ghcjs/ghc-7.2 * [new branch] ghc-7.4-> ghcjs/ghc-7.4 * [new branch] master -> ghcjs/master You asked to pull from the remote 'ghcjs', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line. So I am doing: git pull ghcjs ghc-7.4 Then "git branch ghc-7.4 ghcjs/ghc-7.4" gives me: fatal: A branch named 'ghc-7.4' already exists. And finaly "perl boot" fails with: Error: libraries/extensible-exceptions/LICENSE doesn't exist. Maybe you haven't done './sync-all get'? at boot line 74, line 57. What can I do? I suggest contacting the author of ghcjs, I don't know which branch(es) of ghcjs are supposed to work and/or whether there are any ghcjs-specific build requirements. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [GHC Users] Dictionary sharing
Jonas Almström Duregård wrote: > Thank you for your response Edward, > > You write that it is usually only evaluated once, do you know the > circumstances under which it is evaluated more than once? I have some > examples of this but they are all very large. Only the dictionaries for type class instances that do not depend on other instances will be CAFs and evaluated at most once. When an instance has such dependencies, as for example (from your initial mail in this thread), instance List a => List [a] where list = permutations list then dictionaries will be created on demand (causing re-evaluation of 'list' in this particular case). More precisely, when the compiler finds that a function needs a List [a] instance where only a List a instance is available, it will create a fresh dictionary for List [a] using the above implementation. I am not aware of GHC providing any caching or memoisation mechanism for this, so I think that your solution of building your own using Typeable is appropriate. Best regards, Bertram -- Example program showing addresses of various Ord dictionaries. -- Contents may be hazardous if swallowed! Keep away from children! {-# LANGUAGE MagicHash, Rank2Types #-} module Main where import GHC.Exts import GHC.Int newtype GetDict = GetDict { unGetDict :: forall a . Ord a => a -> Int } -- Evil hack for extracting the address of a dictionary from a function -- call. Note that these addresses may change during GC! getDict :: Ord a => a -> Int getDict = unGetDict (unsafeCoerce# getDict') where getDict' :: Addr# -> Addr# -> Int getDict' d _ = I# (addr2Int# d) {-# NOINLINE bar #-} -- newListDict is designed to force the creation of a new Ord [a] -- dictionary given an Ord a dictionary, and return the new dictionary's -- address. getListDict :: Ord a => a -> Int getListDict x = unGetDict (GetDict (\x -> getDict [x])) x main = do print $ getDict (1 :: Int) -- using a CAF dictionary print $ getDict (2 :: Int) -- same as previous print $ getDict (2 :: Word) -- a different CAF dictionary print $ getDict ([1] :: [Int]) -- also a CAF! print $ getDict ([2] :: [Int]) -- same as previous print $ getListDict (1 :: Int) -- a dynamically created dictionary print $ getListDict (2 :: Int) -- different from previous ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users