[Haskell-cafe] Working with the code For Typing Haskell In Haskell
Hi all, I'm working with the code that accompanies this paper (http://web.cecs.pdx.edu/~mpj/thih/) and I'm trying to use it but I can't figure out how to get started. I have the following code but it is not giving me the expected result: import TypingHaskellInHaskell mapt = map :: Forall [Star, Star] ([] := ((TGen 0 `fn` TGen 1) `fn` TAp tList (TGen 0) `fn` TAp tList (TGen 1))) idt = id :: Forall [Star] ([] := (TGen 0 `fn` TGen 0)) exprt = Ap (Const mapt) (Const idt) test = runTI $ tiExpr initialEnv [] exprt When I execute the test function above in ghci I get: ([],TVar (Tyvar v3 Star)). I was expecting someting like below for the type part: TAp tList (TGen 0) `fn` TAp tList (TGen 0) What I want is the library to compute for me the type of map id. What is the proper way to achieve this? Has anybody on the list worked with this code before? Thanks as lot, Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fwd: Questions about lambda calculus
Hi all, Sorry for cross-posting this, but I didn't get anything on the beginners list so I thought I'd give it a try here. Thanks, Patrick -- Forwarded message -- From: Patrick LeBoutillier patrick.leboutill...@gmail.com Date: Thu, Nov 4, 2010 at 2:02 PM Subject: Questions about lambda calculus To: beginners beginn...@haskell.org Hi all, I've been reading this article: http://perl.plover.com/lambda/tpj.html in which the author talks about the lambda calculus and uses examples in Perl (here's a link directly to the code: http://perl.plover.com/lambda/lambda-brief.pl) I'm a total newbie with respect to the lambda calculus. I tried (naively) to port these examples to Haskell to play a bit with them: fTRUE = \a - \b - a fFALSE = \a - \b - b fIF = \b - \x - \y - b x y fPAIR = \a - \b - \f - f a b fFIRST = \p - p fTRUE fSECOND = \p - p fFALSE fZERO = fPAIR fTRUE fTRUE fSUCC = \x - fPAIR fFALSE x fIS_ZERO = \x - fFIRST x fPRED = \x - fSECOND x fONE = fSUCC fZERO fTWO = fSUCC fONE fADD = \m - (\n - fIF (fIS_ZERO m) n (fADD (fPRED m) (fSUCC n))) but I couldn't get fADD to compile: Occurs check: cannot construct the infinite type: t = (t1 - t1 - t1) - t Probable cause: `fADD' is applied to too many arguments In the third argument of `fIF', namely `(fADD (fPRED m) (fSUCC n))' In the expression: fIF (fIS_ZERO m) n (fADD (fPRED m) (fSUCC n)) I think its because in these Perl examples all functions are treated as being of the same type (number or type of args doesn't matter), but this is not the case in Haskell. Is there any way to create code similar to this in Haskell? Thanks, Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Questions about lambda calculus
Thanks a lot Ryan. That's exactly what I was looking for. Patrick On Wed, Nov 10, 2010 at 12:36 PM, Ryan Ingram ryani.s...@gmail.com wrote: Max has a good solution, but another solution is to embed an untyped lambda calculus into Haskell -- atom is just used for output during testing data U = Atom Int | F (U - U) instance Show U where show (Atom s) = s show (F _) = function -- function application F f $$ x = f x infixl 9 $$ fTrue = F $ \x - F $ \y - x fFalse = F $ \x - F $ \y - y fIf = F $ \b - F $ \x - F $ \y - b $$ x $$ y etc. getAtom (Atom x) = x fNat :: U - U fNat n = fIf $$ (fIsZero $$ n) $$ Atom 0 $$ Atom (getAtom (fNat $$ (fPred $$ n)) + 1) -- getAtom (fNat $$ (fAdd $$ fOne $$ fTwo)) == 3 An even better encoding is this: data UAtom a = Atom a | F (UAtom a - UAtom a) newtype U = U { unU :: forall a. UAtom a } Notice that there are no objects of type U with any non-bottom Atoms. So you can be more sure there's nothing tricky going on inside, but then when you want to go back to Haskell-land and actually extract information, you can switch to UAtom at whatever type you like. It is still possible to do tricksy stuff like case analyze and do different things to functions and atoms. I'll leave fixing that as an exercise :) ($$) :: U - U - U (U (F f)) $$ (U x) = U (f x) lam :: (forall a. UAtom a - UAtom a) - U lam f = U (F f) fTrue = lam $ \x - lam $ \y - x .. etc. On Wed, Nov 10, 2010 at 4:49 AM, Patrick LeBoutillier patrick.leboutill...@gmail.com wrote: Hi all, Sorry for cross-posting this, but I didn't get anything on the beginners list so I thought I'd give it a try here. Thanks, Patrick -- Forwarded message -- From: Patrick LeBoutillier patrick.leboutill...@gmail.com Date: Thu, Nov 4, 2010 at 2:02 PM Subject: Questions about lambda calculus To: beginners beginn...@haskell.org Hi all, I've been reading this article: http://perl.plover.com/lambda/tpj.html in which the author talks about the lambda calculus and uses examples in Perl (here's a link directly to the code: http://perl.plover.com/lambda/lambda-brief.pl) I'm a total newbie with respect to the lambda calculus. I tried (naively) to port these examples to Haskell to play a bit with them: fTRUE = \a - \b - a fFALSE = \a - \b - b fIF = \b - \x - \y - b x y fPAIR = \a - \b - \f - f a b fFIRST = \p - p fTRUE fSECOND = \p - p fFALSE fZERO = fPAIR fTRUE fTRUE fSUCC = \x - fPAIR fFALSE x fIS_ZERO = \x - fFIRST x fPRED = \x - fSECOND x fONE = fSUCC fZERO fTWO = fSUCC fONE fADD = \m - (\n - fIF (fIS_ZERO m) n (fADD (fPRED m) (fSUCC n))) but I couldn't get fADD to compile: Occurs check: cannot construct the infinite type: t = (t1 - t1 - t1) - t Probable cause: `fADD' is applied to too many arguments In the third argument of `fIF', namely `(fADD (fPRED m) (fSUCC n))' In the expression: fIF (fIS_ZERO m) n (fADD (fPRED m) (fSUCC n)) I think its because in these Perl examples all functions are treated as being of the same type (number or type of args doesn't matter), but this is not the case in Haskell. Is there any way to create code similar to this in Haskell? Thanks, Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] running and understanding a lifting program
Patrick, On Mon, Oct 25, 2010 at 6:12 PM, Patrick Browne patrick.bro...@dit.ie wrote: Patrick, Thanks for taking the time to get the program running. It seems fine, but I cannot get the *md* to print out, probably missing the Show class somewhere. md is a function to which you have to give a Time value, basically the Time at which you want to evaluate the Changing points' positions. Try md 2 in ghci, it should give you the expected value. Patrick Thanks again, Pat Patrick LeBoutillier wrote: Patrick, I found this program interesting and decided to spend a bit of time on it, even though I'm still a newbie. I did a few things to simplify the code, here are some comments: 1) I chose to rename the arithmetic functions in the Number class instead of trying to overload the real ones, I'm not that good at Haskell yet... 2) The program had some errors, namely I think the definition of the Point type should be: data Point a = Point a a to allow for different types of Points. 3) The Points class seemed useless in the end, I simply defined the dist function at the top level. 4) If you import Control.Monad, it makes functions (and therefore Changing v) into a Monad (maybe my terminology is off here...) and allows you to use the general liftM and liftM2 lifting functions instead of defining your own. Here's the complete program: {-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} data Point a = Point { x ::a, y :: a } type Time = Float -- Functor Changing, which adds time parameter t to its input value. -- For example, Changing Float indicates a changing floating number -- (i.e. a function of time). type Changing v = Time - v -- Lifting functions lift1 op a = \t - op (a t) lift2 op a b = \t - op (a t) (b t) class Number a where add, sub, mul :: a - a - a square, squareRoot :: a - a square a = a `mul` a instance Number Float where add = (+) sub = (-) mul = (*) squareRoot = sqrt instance Number (Changing Float) where add = lift2 add sub = lift2 sub mul = lift2 mul squareRoot = lift1 squareRoot -- The distance operation is defined as follow dist :: Number a = Point a - Point a - a dist a b = squareRoot $ square((x a) `sub` (x b)) `add` square ((y a) `sub` (y b)) -- Running the code -- If p1 and p2 are two 2D static points, -- their distance d is calculated as follows: p1, p2 :: Point Float p1 = Point 3.4 5.5 p2 = Point 4.5 4.5 -- distance between p1 and p2 -- 1.55 d = dist p1 p2 -- For 2D moving points mp1 and mp2, their distance md, -- which is a function of time, is calculated as follows: mp1, mp2 :: Point (Changing Float) mp1 = Point (\t - 4.0 + 0.5 * t) (\t - 4.0 - 0.5 * t) mp2 = Point (\t - 0.0 + 1.0 * t) (\t - 0.0 - 1.0 * t) -- distance between mp1 and mp2 md = dist mp1 mp2 -- distance md for time 2 5.83 This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Patrick This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell-beginners] Re: Accounting Engine in Haskell
Hi, Keep in mind that you have to invest some time in learning Haskell before you can reap the benefits. For an example of the latter, see also Paul Hudak, Mark P. Jones. Haskell vs. Ada vs. C++ vs. Awk vs. ..., An Experiment in Software Prototyping Productivity http://haskell.org/papers/NSWC/jfp.ps This paper was very interesting to me. Does anyone know if the full source code for the Haskell prototype is available somewhere? Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] learning advanced haskell
Hi all, On Mon, Jun 14, 2010 at 1:42 AM, Aran Donohue aran.dono...@gmail.com wrote: resources. John Lato's recent Iteratee article is a notable exception*. Can anyone provide a link to the article (if it's available online)? Thanks, Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure
On Thu, May 27, 2010 at 3:17 PM, Mike Dillon m...@embody.org wrote: begin C. McCann quotation: Personally, I advocate instead using Sinister and Dexter. Nice and catchy, don't you think? Has anyone done a translation of the Prelude into Latin? modulus PraeLudus ubi data Uter a b = Sinister a | Dexter b derivare (Aequo, Ordinaro, Lego, Monstro) Ha. Not Haskell, but check this one out: http://search.cpan.org/~dconway/Lingua-Romana-Perligata-0.50/lib/Lingua/Romana/Perligata.pm Patrick -md ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [OT?] Haskell-inspired functions for BASH
Hi all, I've been studying Haskell for about a year now, and I've really come to like it. In my daily work I write a lot of BASH shell scripts and I thought I'd try add some of the haskell features and constructs to BASH to make my scripting life a bit easier. So I've been working on a small BASH function library that implements some basic functional programming building blocks. Note: There is no actual Haskell code involved here. I put up the full manpage here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=24564 Source is here: http://svn.solucorp.qc.ca/repos/solucorp/bashkell/trunk/trunk/ All this is very prototypical, but here is an example of some of the stuff I've got so far (map, filter, foldr): $ ls data 1.txt 2.txt # basic map, argument goes on the command line $ ls -d data/* | map basename 1.txt 2.txt # map with lambda expression $ ls -d data/* | map '\f - basename $f .txt' 1 2 # simple filter, also works with lambda $ ls -d data/* | map basename | filter 'test 1.txt =' 1.txt # sum $ ls -d data/* | map '\f - basename $f .txt' | foldr '\x acc - echo $(($x + $acc))' 0 3 Basically I'm looking for a bit of feedback/info: - Does anyone know if there are already similar projets out there? - Does anyone find this interesting? - Any other comment/suggestion/feedback - Where's a good place to promote such a project? Thanks a lot, Patrick LeBoutillier -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the meaning of tilde (~) symbol
Hi, The symbols that are not specified in a library can be found here: http://www.haskell.org/haskellwiki/Keywords I noticed that \ is not in that list, should it be? Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Interpreting profiling results
On Mon, Jan 4, 2010 at 10:05 AM, Daniel Fischer daniel.is.fisc...@web.de wrote: Am Montag 04 Januar 2010 02:17:06 schrieb Patrick LeBoutillier: Hi, This question didn't get any replies on the beginners list, I thought I'd try it here... Sorry, been occupied with other things. I already took a look, but hadn't anything conclusive enough to reply yet. No sweat... I didn't mean to be pushy :) Thanks a lot for all the pointers, they have speeded up my code a lot. Patrick I've written (and improved using other solutions I've found on the net) a simple sudoku solver which I'm trying to profile. Here is the code: import Array Better import Data.Array.Unboxed *much* faster import List (transpose, nub, (\\)) import Data.List data Sudoku = Sudoku { unit :: Int, cells :: Array (Int, Int) Int, cells :: UArray (Int,Int) Int holes :: [(Int, Int)] } cell :: Sudoku - (Int, Int) - Int cell s i = (cells s) ! i instance Read Sudoku where readsPrec _ s = [(Sudoku unit cells holes, )] where unit = length . words . head . lines $ s cells = listArray ((1, 1), (unit, unit)) (map read . words $ s) holes = [ c | c - indices cells, (cells ! c) == 0] instance Show Sudoku where show s = unlines [unwords [show $ cell s (x,y) | x - [1 .. unit s]] | y - [1 .. unit s]] genNums :: Sudoku - (Int, Int) - [Int] genNums s c@(i,j) = ([1 .. u] \\) . nub $ used where nub isn't nice. It's quadratic in the length of the list. Use e.g. map head . group . sort or Data.[Int]Set.toList . Data.[Int]Set.fromList if the type is in Ord (and you don't need the distinct elements in the order they come in). That gives an O(n*log n) nub with a sorted result. And (\\) isn't particularly fast either (O(m*n), where m and n are the lengths of the lists). If you use one of the above instead of nub, you can use the O(min m n) 'minus' for sorted lists: xxs@(x:xs) `minus` yys@(y:ys) | x y = x : xs `minus` yys | x == y = xs `minus` ys | otherwise = xxs `minus` ys xs `minus` _ = xs Here, you can do better: genNums s c@(i,j) = nums where nums = [n | n - [1 .. u], arr!n] arr :: [U]Array Int Bool arr = accumArray (\_ _ - False) True (0,u) used used = (row s u i j) ++ (col s u i j) ++ (square s sq u i j) u = unit s Not good to calculate sq here. You'll use it many times, calculate once and store it in s. sq = truncate . sqrt . fromIntegral $ u row s u i j = [cell s (i, y) | y - [1 .. u]] col s u i j = [cell s (x, j) | x - [1 .. u]] square s sq u i j = [cell s (x, y) | y - [1 .. u], x - [1 .. u], f x i, f y j] where f a b = div (a-1) sq == div (b-1) sq Test for f y j before you generate x to skip early. square s sq u i j = [cell s (ni+x,nj+y) | x - [1 .. sq], y - [1 .. sq]] where qi = (i-1) `div` sq qj = (j-1) `div` sq ni = qi*sq nj = qj*sq solve :: Sudoku - [Sudoku] solve s = case holes s of [] - [s] (h:hs) - do n - genNums s h let s' = Sudoku (unit s) ((cells s) // [(h, n)]) hs solve s' main = print . head . solve . read = getContents When I compile as such: $ ghc -O2 --make Sudoku.hs -prof -auto-all -caf-all -fforce-recomp and run it on the following puzzle: 0 2 3 4 3 4 1 0 2 1 4 0 0 3 2 1 I get the following profiling report: Fri Jan 1 10:34 2010 Time and Allocation Profiling Report (Final) Sudoku +RTS -p -RTS total time = 0.00 secs (0 ticks @ 20 ms) That means the report is basically useless. Not entirely, because the allocation figures may already contain useful information. Run on a 9x9 puzzle (a not too hard one, but not trivial either). Also, run the profiling with -P instead of -p, you'll get more info about time and allocation then. total alloc = 165,728 bytes (excludes profiling overheads) COST CENTRE MODULE %time %alloc CAF GHC.Handle 0.0 10.7 CAF Text.Read.Lex 0.0 2.1 CAF GHC.Read 0.0 1.2 square Main 0.0 2.8 solve Main 0.0 1.3 show_aVx Main 0.0 3.7 readsPrec_aYF Main 0.0 60.6 main Main 0.0 9.6 genNums Main 0.0 5.0 cell Main 0.0 1.2 individual inherited COST CENTRE MODULE no. entries %time %alloc %time %alloc MAIN MAIN 1 0 0.0 0.3 0.0 100.0 main Main 186 1 0.0 9.6 0.0 85.6 show_aVx
[Haskell-cafe] Interpreting profiling results
Hi, This question didn't get any replies on the beginners list, I thought I'd try it here... I've written (and improved using other solutions I've found on the net) a simple sudoku solver which I'm trying to profile. Here is the code: import Array import List (transpose, nub, (\\)) import Data.List data Sudoku = Sudoku { unit :: Int, cells :: Array (Int, Int) Int, holes :: [(Int, Int)] } cell :: Sudoku - (Int, Int) - Int cell s i = (cells s) ! i instance Read Sudoku where readsPrec _ s = [(Sudoku unit cells holes, )] where unit = length . words . head . lines $ s cells = listArray ((1, 1), (unit, unit)) (map read . words $ s) holes = [ c | c - indices cells, (cells ! c) == 0] instance Show Sudoku where show s = unlines [unwords [show $ cell s (x,y) | x - [1 .. unit s]] | y - [1 .. unit s]] genNums :: Sudoku - (Int, Int) - [Int] genNums s c@(i,j) = ([1 .. u] \\) . nub $ used where used = (row s u i j) ++ (col s u i j) ++ (square s sq u i j) u = unit s sq = truncate . sqrt . fromIntegral $ u row s u i j = [cell s (i, y) | y - [1 .. u]] col s u i j = [cell s (x, j) | x - [1 .. u]] square s sq u i j = [cell s (x, y) | y - [1 .. u], x - [1 .. u], f x i, f y j] where f a b = div (a-1) sq == div (b-1) sq solve :: Sudoku - [Sudoku] solve s = case holes s of [] - [s] (h:hs) - do n - genNums s h let s' = Sudoku (unit s) ((cells s) // [(h, n)]) hs solve s' main = print . head . solve . read = getContents When I compile as such: $ ghc -O2 --make Sudoku.hs -prof -auto-all -caf-all -fforce-recomp and run it on the following puzzle: 0 2 3 4 3 4 1 0 2 1 4 0 0 3 2 1 I get the following profiling report: Fri Jan 1 10:34 2010 Time and Allocation Profiling Report (Final) Sudoku +RTS -p -RTS total time = 0.00 secs (0 ticks @ 20 ms) total alloc = 165,728 bytes (excludes profiling overheads) COST CENTRE MODULE %time %alloc CAF GHC.Handle 0.0 10.7 CAF Text.Read.Lex 0.0 2.1 CAF GHC.Read 0.0 1.2 square Main 0.0 2.8 solve Main 0.0 1.3 show_aVx Main 0.0 3.7 readsPrec_aYF Main 0.0 60.6 main Main 0.0 9.6 genNums Main 0.0 5.0 cell Main 0.0 1.2 individual inherited COST CENTRE MODULE no. entries %time %alloc %time %alloc MAIN MAIN 1 0 0.0 0.3 0.0 100.0 main Main 186 1 0.0 9.6 0.0 85.6 show_aVx Main 196 2 0.0 3.7 0.0 3.7 cell Main 197 16 0.0 0.0 0.0 0.0 solve Main 188 5 0.0 1.3 0.0 11.8 genNums Main 189 8 0.0 5.0 0.0 10.4 square Main 194 88 0.0 2.8 0.0 3.2 cell Main 195 16 0.0 0.4 0.0 0.4 col Main 192 4 0.0 0.7 0.0 1.1 cell Main 193 16 0.0 0.4 0.0 0.4 row Main 190 4 0.0 0.7 0.0 1.1 cell Main 191 16 0.0 0.4 0.0 0.4 readsPrec_aYF Main 187 3 0.0 60.6 0.0 60.6 CAF GHC.Read 151 1 0.0 1.2 0.0 1.2 CAF Text.Read.Lex 144 8 0.0 2.1 0.0 2.1 CAF GHC.Handle 128 4 0.0 10.7 0.0 10.7 CAF GHC.Conc 127 1 0.0 0.0 0.0 0.0 Does the column 'entries' represent the number of times the function was called? If so, I don't understand how the 'square' function could be called 88 times when it's caller is only called 8 times. Same thing with 'genNums' (called 8 times, and solve called 5 times) What am I missing here? Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] FFI and ghci
Hi all, I have a small FFI-based library that I like to test like this: $ ghci -I../c -L../c/.libs -lmlp t.hs GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading object (dynamic) mlp ... done final link ... done [1 of 9] Compiling MLP ( MLP.hs, interpreted ) [2 of 9] Compiling MLP.Error( MLP/Error.hs, interpreted ) [3 of 9] Compiling MLP.Context ( MLP/Context.hs, interpreted ) [4 of 9] Compiling MLP.Runtime ( MLP/Runtime.hs, interpreted ) [5 of 9] Compiling MLP.Object ( MLP/Object.hs, interpreted ) [6 of 9] Compiling MLP.Type ( MLP/Type.hs, interpreted ) [7 of 9] Compiling MLP.Value( MLP/Value.hs, interpreted ) [8 of 9] Compiling MLP.Language ( MLP/Language.hs, interpreted ) [9 of 9] Compiling Main ( t.hs, interpreted ) Ok, modules loaded: MLP, MLP.Object, Main, MLP.Runtime, MLP.Context, MLP.Error, MLP.Value, MLP.Type, MLP.Language. *Main main Note: Inside libmlp.so, another shared object is loaded using dlopen(). When running this test program I get some sporadic segmentation faults, which seem to always occur at entrypoint to the shared object that is loaded with dlopen(). But when I compile it with ghc, i.e. $ ghc --make -I../c -L../c/.libs -lmlp t.hs I can't reproduce crash. Can anyone see why this could be happening? It's quite possible that there is really a bug in the C code, but if someone knows about a bug or something in ghci that can cause this behaviour I can stop looking... Thanks a lot, Patrick -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Weekly News: Issue 134 - October 10, 2009
-- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Libraries for Commercial Users
Don, Having painless Haskell - Java interoperability would be great. I'm curious though: could it really be so simple as a one-line ``import foreign jvm'' directive? I imagine the purity mismatch between Haskell and Java would be very troublesome. No more so than C, surely. We're used to stateful APIs. They're a pain. With this hypothetical ``import foreign jvm'' mechanism, what would the be type of imported Java stuff? Would it all be done in IO? The more I think about it, the trickier it seems. Beside the purity mismatch of Haskell and Java, there is an OO/functional mismatch. That's more of an issue. But the prior work has been done. Do you have any references to this work? I'm quite interested in this, both from a Haskell perpective (although I'm still a beginner) and from being the author of a Perl - Java interoperability module (see http://search.cpan.org/~patl/Inline-Java-0.52/). Thanks, Patrick ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell and symbolic references
Hi all, Is it possible with Haskell to call a function whose name is contained in a String? Something like: five = call_func add [2, 3] If not, perhaps this is acheivable using FFI? Thanks a lot, Patrick Leboutillier -- = Patrick LeBoutillier Rosemère, Québec, Canada ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe