Re: [Haskell-cafe] gtk2hs and GTK+OSX
Hi Jeroen, I've done this. I didn't use the stuff from gtk-osx.org, but rather from the imendio site itself. I'm not sure how it would work with binary package they now provide, but if you use their jhbuild scripts you get something usable. It's ugly, but it works for compiled gtk2hs programs. If I recall correctly, invoking it from ghci may give some trouble. Regards, Scott On Tue, Oct 14, 2008 at 7:01 AM, Jeroen Baekelandt [EMAIL PROTECTED] wrote: Hi, I was wondering if anybody managed to get gtk2hs working with GTK+OSX from http://www.gtk-osx.org/ I'm trying but there seems to be a quite long dependency list that keeps on building up. So I was wondering if it ends and if it works in the end. Thanks, Jeroen ___ 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] Best way to find an undefined error?
Hello all, Does anyone favourite technique to track down an undefined call? I'm 99% sure that my code is not the offender (I've grepped for undefined occurrences and turned them all into error calls). Supposing that this is happening in some other package or library that I'm using, what is the best way to find out where it is? I have profiling enabled on all libraries that I use, so I'm ok there I think. Any magic combination of +RTS .. -RTS? Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Best way to find an undefined error?
On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote: On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote: You can use the profiler to get a stack trace, or use the new GHCi debugger to step backwards from the exception to the source. I wrote a bit of a tutorial for this here: http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions Section 6.3 of http://haskell.org/haskellwiki/Debugging also is relevant for using ghcu to step backward ... perhaps the section label is misleading, though. Feel free to modify as needed if you find the ghci stepper lets you find the problem Well, when using +RTS -xc, I get: GHC.Err.CAFGHC.Err.CAFPrelude.undefined I'm not really sure what to do with this, not really the stacktrace I was hoping for. The ghci debugger I found was really quite nice, up until it his some portion of code that it isn't interpreting. By not interpreting i mean things that have been already been compiled and it's just calling (even if it has been compiled with profiling). I have a feeling that my problem is somewhere in something that has already been compiled. Knowing that, should +RTS -xc be giving me more information? Is there a way for it to do so? Regards, Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Best way to find an undefined error?
On Thu, Feb 14, 2008 at 4:43 PM, Don Stewart [EMAIL PROTECTED] wrote: saynte: On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote: On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote: You can use the profiler to get a stack trace, or use the new GHCi debugger to step backwards from the exception to the source. I wrote a bit of a tutorial for this here: http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions Section 6.3 of http://haskell.org/haskellwiki/Debugging also is relevant for using ghcu to step backward ... perhaps the section label is misleading, though. Feel free to modify as needed if you find the ghci stepper lets you find the problem Well, when using +RTS -xc, I get: GHC.Err.CAFGHC.Err.CAFPrelude.undefined I'm not really sure what to do with this, not really the stacktrace I was hoping for. The ghci debugger I found was really quite nice, up until it his some portion of code that it isn't interpreting. By not interpreting i mean things that have been already been compiled and it's just calling (even if it has been compiled with profiling). I have a feeling that my problem is somewhere in something that has already been compiled. Is it possible to just load all the code interpreted? Or is the problem in a dependent library? If you profile and let the program terminate, there should be a stack trace in the .prof as well. -- Don Well, I can load a bunch of it interpreted. I've already done this as far as I think I can. The only pieces laying outside the interpreter are the GHC libraries and Gtk2Hs. The really funny thing, is that (essentially) I believe the error results from a call to fromDynamic out of Data.Dynamic. This sort of leads me to believe that someone's Typeable instance is being funny. Again though, all the Typeable's in the immediate area of my code seem to be fine. (the .prof didn't seem to reveal anything yet... I'll look it over a little more closely though) Regards, Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Best way to find an undefined error?
On Thu, Feb 14, 2008 at 5:12 PM, Scott West [EMAIL PROTECTED] wrote: On Thu, Feb 14, 2008 at 4:43 PM, Don Stewart [EMAIL PROTECTED] wrote: saynte: On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote: On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote: You can use the profiler to get a stack trace, or use the new GHCi debugger to step backwards from the exception to the source. I wrote a bit of a tutorial for this here: http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions Section 6.3 of http://haskell.org/haskellwiki/Debugging also is relevant for using ghcu to step backward ... perhaps the section label is misleading, though. Feel free to modify as needed if you find the ghci stepper lets you find the problem Well, when using +RTS -xc, I get: GHC.Err.CAFGHC.Err.CAFPrelude.undefined I'm not really sure what to do with this, not really the stacktrace I was hoping for. The ghci debugger I found was really quite nice, up until it his some portion of code that it isn't interpreting. By not interpreting i mean things that have been already been compiled and it's just calling (even if it has been compiled with profiling). I have a feeling that my problem is somewhere in something that has already been compiled. Is it possible to just load all the code interpreted? Or is the problem in a dependent library? If you profile and let the program terminate, there should be a stack trace in the .prof as well. -- Don Well, I can load a bunch of it interpreted. I've already done this as far as I think I can. The only pieces laying outside the interpreter are the GHC libraries and Gtk2Hs. The really funny thing, is that (essentially) I believe the error results from a call to fromDynamic out of Data.Dynamic. This sort of leads me to believe that someone's Typeable instance is being funny. Again though, all the Typeable's in the immediate area of my code seem to be fine. (the .prof didn't seem to reveal anything yet... I'll look it over a little more closely though) Regards, Scott I did finally find the error (in one of the pieces of code not written by myself). A few instances of Typeable were trying to pattern match their arguments. *bomb* In either case, it was an interesting experience! Thanks for the help all! Regards, Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Dealing with large OOHaskell records
Hello all, Does anyone have any experience with using large-ish (20 element) OOHaskell records? I'm finding that as the records get large, compile times get fairly ridiculous. Is there some explicit typing I should be doing to help the type-checker? Thanks! Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Class Interfaces in OOHaskell?
Hello all, Looking at the OOHaskell black (grey?) magic, and wondering if there would be an interesting way to construct class interfaces using the OOHaskell paradigm? I'm trying to do it as so (assume relevant types/proxies declared): type FigureInter = Record ( Draw :=: IO () :*: HNil ) figure self = do return emptyRecord where _ = narrow self :: FigureInter abstrFigure self = do super - figure self visible - newIORef True returnIO $ setVisible .=. (\b - writeIORef visible b) .*. isVisible .=. readIORef visible .*. draw .=. return () .. super but ghci complains (you know how it likes to complain), with Couldn't match expected type `Record t2' against inferred type `F (Proxy Draw) (m ())' In the second argument of `(.*.)', namely `draw .=. (return ())' In the second argument of `(.*.)', namely `(isVisible .=. (readIORef visible)) .*. (draw .=. (return ()))' In the first argument of `(..)', namely `(setVisible .=. (\ b - writeIORef visible b)) .*. ((isVisible .=. (readIORef visible)) .*. (draw .=. (return (' Anyone have any tips they care to share? :) Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Class Interfaces in OOHaskell?
I conquered the below problem, but now I have another question: How can one have two interface-classes that reference each other? For example, type Inter1 = Record ( MkFoo :=: Inter2 - IO () :*: HNil ) type Inter2 = Record ( MkBar :: Inter1 - IO () :*: HNil ) Obviously this is cyclical, but is there a nice way to get around it? I think I could wrap them up in a datatype (ie, data InterOne = InterOne Inter1, and modify definitions accordingly) but are there any alternative methods? Scott On 7/6/07, Scott West [EMAIL PROTECTED] wrote: Hello all, Looking at the OOHaskell black (grey?) magic, and wondering if there would be an interesting way to construct class interfaces using the OOHaskell paradigm? I'm trying to do it as so (assume relevant types/proxies declared): type FigureInter = Record ( Draw :=: IO () :*: HNil ) figure self = do return emptyRecord where _ = narrow self :: FigureInter abstrFigure self = do super - figure self visible - newIORef True returnIO $ setVisible .=. (\b - writeIORef visible b) .*. isVisible .=. readIORef visible .*. draw .=. return () .. super but ghci complains (you know how it likes to complain), with Couldn't match expected type `Record t2' against inferred type `F (Proxy Draw) (m ())' In the second argument of `(.*.)', namely `draw .=. (return ())' In the second argument of `(.*.)', namely `(isVisible .=. (readIORef visible)) .*. (draw .=. (return ()))' In the first argument of `(..)', namely `(setVisible .=. (\ b - writeIORef visible b)) .*. ((isVisible .=. (readIORef visible)) .*. (draw .=. (return (' Anyone have any tips they care to share? :) Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Question about HList possibilities
Hello all, Given an HList (http://homepages.cwi.nl/~ralf/HList/) would it be possible to do the following: Create a class/function/magicks that would essentially do what hOccursMany does, except it would not return a list of elements, but a new HList. For example, would this allow us to be able to write more lax typing constraints and say extract only things that are in lists. ie) HCons hi (HCons [2.2,3.3] (HCons 'a' hNil)) - HCons hi (HCons [2.2,3.3] hNil) (removing the Char element). I tried to write something like this but I did not get very far, is it even possible? I'm new to this type-level programming :) Scott ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Existential type within a record ... bad?
Hello all, Just got an interesting error, which I can't really understand (but that DOES happen a lot...). Trying to work with existention types, record types, and wrapping the whole thing up in a nice IORef for my uses: data ETable = forall a. EditableTable a = ETable a data GuiRecord = GuiRecord {gtable :: ETable, moz :: MozEmbed, pos :: Position, ent :: Entry} type GuiState = IORef (GuiRecord) Generates the following error: Couldn't match `* - Type bx' against `*' In the type synonym declaration for `GuiState' Anyone have any ideas?? Thanks in advance! Regards, Scott ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] c2hs and gtk+hs problem
Hello all, I've recently attempted to get the gtk+hs bindings operational, with evidently no success. They both compile fine, but when trying to make all the examples in the gtk+hs tree, it gives up with: /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(C2HS.o)(.text+0x32): In function `__stginit_C2HS_': : undefined reference to `__stginit_CForeign_' /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(C2HSBase.o)(.text+0x28): In function `__stginit_C2HSBase_': : undefined reference to `__stginit_MarshalUtils_' /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(C2HSMarsh.o)(.text+0x32): In function `__stginit_C2HSMarsh_': : undefined reference to `__stginit_CString_' /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(C2HSMarsh.o)(.text+0x3c): In function `__stginit_C2HSMarsh_': : undefined reference to `__stginit_MarshalUtils_' /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(C2HSMarsh.o)(.text+0x50): In function `__stginit_C2HSMarsh_': : undefined reference to `__stginit_MarshalAlloc_' /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(C2HSMarsh.o)(.text+0x5a): In function `__stginit_C2HSMarsh_': : undefined reference to `__stginit_Ptr_' /usr/local/lib/c2hs-0.12.0/ghc6/libc2hs.a(NewStorable.o)(.text+0x28): In function `__stginit_NewStorable_': : undefined reference to `__stginit_Storable_' collect2: ld returned 1 exit status Does anyone have any possible ways to resolve this? Thanks for any help!! Regards, Scott ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to hold common data
Hello all, I'm new to haskell and was just wondering if there was any efficient or standard way to store and modify some sort of state data. The functional nature of haskell has me confused in this respect! Basically what I want to achieve is an interactive program that allows you to edit some tables, and thus hold some data. I dont' need to be spoonfed an answer, but a general guideline would be very helpful :) Thanks for any help you could provide! Regards, Scott ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to hold common data
MR K P SCHUPKE wrote: simplest way... use a recursive function that feeds itself the state as one of its arguments... Mmm, yes I had thought of that. But I wasn't sure how it would work, as you can't have variables in the same sense as imperative languages. So if I create a mainloop sort of function, that passes the old state into itself, then would I have to modify the output within that fucntion to get it to display to the user, correct? Thanks for the response! Regards, Scott ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe