[Haskell-cafe] Opaque types vs automated instance deriving

2011-06-20 Thread Alexey Karakulov
Hi all, I encountered a problem when trying to derive makeBinary ''DiffTime with help of *derive* package. The error was: Not in scope: data constructor `MkDiffTime' Which makes a sense, since it's not exported in Data.Time.Clock. I bypassed the problem (yes, I'm too lazy to write instances

[Haskell-cafe] Template Haskell question

2011-04-17 Thread Alexey Karakulov
I'm interested if it's possible to use functions from some module without explicitly importing it. In ghci it's done on the fly, like this: Prelude Data.Map.empty Loading package array-0.3.0.2 ... linking ... done. Loading package containers-0.4.0.0 ... linking ... done. fromList [] But without

[Haskell-cafe] IO-oriented cache library for interacting with GUI

2010-09-16 Thread Alexey Karakulov
Hi. I'm writing GUI (gtk) program which purpose is take some data as user input, perform some evaluations, and produce some plots and coefficients. Since some evaluations take significant time (about 10 seconds), I try to cache results. The problem is that dependency structure is quite

Re: [Haskell-cafe] Removing polymorphism from type classes (viz. Functor) (Again)

2010-08-15 Thread Alexey Karakulov
On Sun, Aug 15, 2010 at 10:50 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Yeah, I'm working on something like this at the moment, but I'm currently stuck on naming: if I want to have Functor for kind * - *, what's a good name for a type class for kind *? I was thinking about

[Haskell-cafe] Removing polymorphism from type classes (viz. Functor) (Again)

2010-08-14 Thread Alexey Karakulov
I was inspired by George Pollard's posthttp://www.haskell.org/pipermail/haskell-cafe/2009-July/063981.htmlat haskell-cafe and tried to implement the non-polymorphic Functor class ( I named it Functor' ). I changed some names and added reasonable constraints. type family NewPt f a class

Re: [Haskell-cafe] Removing polymorphism from type classes (viz. Functor) (Again)

2010-08-14 Thread Alexey Karakulov
On Sat, Aug 14, 2010 at 2:27 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Alexey Karakulov ankaraku...@gmail.com writes: (Ord b) must be deduced from (Functor (Set b)) but it doesn't. I don't know whether it's my mistake somewhere or ghc problem. I've come across

[Haskell-cafe] How to do this with associated types?

2010-07-25 Thread Alexey Karakulov
Suppose I have one piece of code like this: class Result r e | r - e where   failure :: e - r a     success :: a - r a at :: Result r String = [a] - Int - r a at xs i = if i = 0 i length xs     then success (xs !! i)     else failure Wrong index Either instance of

[Haskell-cafe] point-free ADT pattern matching ?

2010-07-15 Thread Alexey Karakulov
I wonder if pattern matching could be less verbose. Maybe this sounds weird, but here is example of what I mean: type A = (Int, String) f :: String - A - A f s (i,s') = (i, s ++ s') data B = B Int String deriving Show g :: String - B - B g s (B i s') = B i $ s ++ s' Types A/B and