[Haskell-cafe] Re: [Coq-Club] An encoding of parametricity in Agda
On Wed, Sep 23, 2009 at 6:46 AM, Eugene Kirpichov ekirpic...@gmail.com wrote: It contains an ingenious (to my mind) encoding of parametricity in Agda that makes the Free Theorems a trivial consequence. Perhaps I don't understand Agda very well, but I don't see parametricity here. For one, there's no attempt to prove that: forall (P Q : forall a, a - a), P = Q. which is what parametricity means to me. -- Taral tar...@gmail.com Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell
On Mon, May 18, 2009 at 10:06 PM, Ryan Ingram ryani.s...@gmail.com wrote: On Mon, May 18, 2009 at 3:05 PM, Taral tar...@gmail.com wrote: Will this do? (=) :: (NFData sa, NFData b) = LI sa - (sa - LI b) - LI b No, the problem is that = on monads has no constraints, it must have the type LI a - (a - LI b) - LI b I'm pretty sure you can do something like: newtype LIMonad x = NFData x = LI x -- Taral tar...@gmail.com Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell
On Mon, May 18, 2009 at 10:30 AM, Nicolas Pouillard nicolas.pouill...@gmail.com wrote: The type I would need for bind is this one: (=) :: NFData sa = LI sa - (sa - LI b) - LI b Will this do? (=) :: (NFData sa, NFData b) = LI sa - (sa - LI b) - LI b -- Taral tar...@gmail.com Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Termination of substitution
On 3/12/08, Neil Mitchell [EMAIL PROTECTED] wrote: However, I don't believe this expression is type safe in Haskell. Using higher-order polymorphism: f (x :: forall a. a - a) = x x -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: fast integer base-2 log function?
On 2/27/08, Chad Scherrer [EMAIL PROTECTED] wrote: Is {-# LANGUAGE MagicHash #-} documented somewhere? I've seen it referenced a few times now, but I can't find any details about it. No. http://hackage.haskell.org/trac/ghc/ticket/1297 -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
On 2/24/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: (define nth (lambda (n xs) (if (= n 0)(head xs)(nth (- n 1) (tail xs) nth n (x:xs) = if n == 0 then x else nth (n-1) xs I'm guessing it's some kind of lisp variant? (define nth (lambda (n xs) (cond ((consp xs) (if (= n 0) (head xs) (nth (- n 1) (tail xs (t nil))) -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell w/ delimited continuations
On Sat, Feb 23, 2008 at 1:05 AM, [EMAIL PROTECTED] wrote: Adding control effects (shift/reset) changes the expressivity results. Now all three calculi are distinct and none subsumes the other. For example, the expression reset( (\x - 1) (abort 2)) evaluates to 1 in call-by-name and evaluate to 2 in call-by-value. The expression reset ((\x - x + x) (shift f f)) has the type int-int in call-by-need (it is a function \x - x + x) and it has the type int-int-int in call-by-name (and it is the curried addition function). Aha. Okay, so shift/reset exposes evaluation order, amongst other things. Hm... thank you very much! -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell w/ delimited continuations
On Sat, Feb 23, 2008 at 1:05 AM, [EMAIL PROTECTED] wrote: reset ((\x - x + x) (shift f f)) This one doesn't typecheck, since you can't unify the types (a - r) and r. -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell w/ delimited continuations
My understanding of these things is limited, but what would stop me, theoretically speaking, of making a version of ghc with these primitives added: type Prompt r reset :: (Prompt r - r) - r shift :: Prompt r - ((a - _) - r) - a (Where _ is either r or forall b. b) -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell w/ delimited continuations
On 2/22/08, Taral [EMAIL PROTECTED] wrote: reset :: (Prompt r - r) - r shift :: Prompt r - ((a - _) - r) - a The point of the question is about shift/reset with *these types*. I know there are implementations with other types. -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haskell w/ delimited continuations
On 2/22/08, Derek Elkins [EMAIL PROTECTED] wrote: Nothing but sanity is stopping you. If you make a new language, you can do whatever you like. However, with shift and reset you can represent any effect, so you would utterly lose purity. Can you give an example of an impure function created using these primitives? -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haskell w/ delimited continuations
On 2/22/08, Derek Elkins [EMAIL PROTECTED] wrote: shift and reset I was under the impression that reset was a pure function. What side effects does it have? -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell w/ delimited continuations
On 2/22/08, Taral [EMAIL PROTECTED] wrote: shift :: Prompt r - ((a - _) - r) - a (Where _ is either r or forall b. b) It occurs to me that _ has to be r, otherwise the subcontinuation can escape. -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] global variables
On 5/24/07, Adrian Hey [EMAIL PROTECTED] wrote: Taral wrote: The other syntaxes proposed don't strike me as sufficiently rigorous. Me neither. It's always been a great source of puzzlement to me why this very simple and IMO conservative proposal should be so controversial. Unless someone can point out some severe semantic difficulty or suggest something better it seems like a no-brainer to me. I think it lacks implementation. I don't have time, or I'd look into hacking this into GHC. -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] global variables
On 5/23/07, Adrian Hey [EMAIL PROTECTED] wrote: I think I still prefer.. var :: IORef Int var - newIORef 3 So do I. For one very good reason: this syntax could be defined as a constructor syntax and guaranteed to run before main. The other syntaxes proposed don't strike me as sufficiently rigorous. -- Taral [EMAIL PROTECTED] Please let me know if there's any further trouble I can give you. -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] Re: state of HaXml?
On 1/10/07, Malcolm Wallace [EMAIL PROTECTED] wrote: Actually, I'm pretty sure that most Haskell RTS implementations have a finalizer attached to all file handles. Once the file handle is no longer reachable from the program graph (even if its data has not been fully consumed), the GC will close the file (via the finalizer) before reaping the memory associated with the handle. That's not the point. The GC will only close the file when the heap is under pressure. It does not aggressively close the file, so the file may stay open for longer than the user likes. For a read-only operation, this shouldn't matter, however on some platforms an open file handle can prevent deletion of the file. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/13/06, Alfonso Acosta [EMAIL PROTECTED] wrote: -- hd and id are (void *) in C and modelled as type parameters in Haskell data Descriptor id hd = Descriptor {uniqueID :: LadspaIndex, label :: String, properties :: LadspaProperties, name, maker, copyright :: String, portCount :: LadspaIndex, portDescriptors:: [PortDescriptor], portNames :: [String], portRangeHints :: [PortRangeHint], implementationData :: id, instantiate:: Descriptor id hd - LadspaIndex - Maybe hd, Oh, LADSPA. Suddenly everything make so much more sense. First, the implementationData is useless to you. Put it in a closure when building this object: ladspa_descriptor = do ... let implementationData = ... return Descriptor { ... referencing implementationData ... } No need to export that to the user only to have them pass it back in. Second, you don't want the consumer to pick the hd type. If you're willing to accept extensions (I think you are), make it existential: data Descriptor = forall hd. Descriptor { ... } This will ensure that you can't pass the handles from one plugin to the methods of another. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/13/06, Alfonso Acosta [EMAIL PROTECTED] wrote: deactivate :: Maybe(hd - IO ()), According to the spec, NULL here means no-op. So instead of using Maybe, just set deactivate = \_ - return () if you see NULL. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/13/06, Taral [EMAIL PROTECTED] wrote: Second, you don't want the consumer to pick the hd type. If you're willing to accept extensions (I think you are), make it existential: data Descriptor = forall hd. Descriptor { ... } This will ensure that you can't pass the handles from one plugin to the methods of another. Third, we can split handles out as actual objects now: data Descriptor = Descriptor {uniqueID :: LadspaIndex, label :: String, properties :: LadspaProperties, name, maker, copyright :: String, portCount :: LadspaIndex, portDescriptors:: [PortDescriptor], portNames :: [String], portRangeHints :: [PortRangeHint], instantiate:: LadspaIndex - IO (Maybe Handle), } data Handle = Handle {descriptor :: Descriptor, activate :: IO (), -- (LadspaIndex,PortData) indicates the portnumber and its data run :: LadspaIndex - [(LadspaIndex,PortData)] - IO [(LadspaIndex, PortData)], deactivate :: IO (), cleanup :: IO (), } Then you'll want helpers that use Control.Exception.bracket to provide exception-safe access to these objects. For example: withHandle h = bracket (activate h) (deactivate h) You can also optionally use cleanup as the finalizer for the ForeignPtr underlying Handles, but the GC isn't guaranteed to be timely about calling finalizers, so that may or may not be what you want. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/13/06, Alfonso Acosta [EMAIL PROTECTED] wrote: I don't see what you mean here. I'm not using ForeignPtrs at all. ... you're *writing* a plugin, not using one. Oh. Um... let me think about that one. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type problem with simple takusen code (was: Trivialdatabase access in Haskell)
On 12/12/06, Paul Moore [EMAIL PROTECTED] wrote: Can I somehow force PostgreSQL to be disabled? If I need to rebuild to do so (grumble) then how do I uninstall the current version of takusen (it's not in Add/Remove programs and runhaskell Setup.hs doesn't seem to offer an uninstall option... There should be a README or INSTALL file in the original tarball that explains how to do that. I suspect it is a flag you have to pass to runhaskell Setup.lhs configure. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/12/06, Alfonso Acosta [EMAIL PROTECTED] wrote: So it would be great to be able to use unsafeCoerce. It would be great -- but Typeable is the only way to get *safe* typecasts of this type. Otherwise, you may as well run without a typechecker. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Aim Of Haskell
On 12/11/06, Nia Rium [EMAIL PROTECTED] wrote: In my humble opinion, in this context, GUI doesn't mean a library to implement a GUI application. It rather means an interpreter/compiler that provides graphical interface. Windows users can use Visual Haskell... -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Aim Of Haskell
On 12/11/06, Philippa Cowderoy [EMAIL PROTECTED] wrote: Only those who already have Visual Studio, no? Yes, that is an unfortunate limitation. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Trivial database access in Haskell
On 12/11/06, Paul Moore [EMAIL PROTECTED] wrote: F:\cabal-1.1.6.1runhaskell Setup.lhs install Installing: C:\Program Files\Haskell\Cabal-1.1.6.1\ghc-6.6 C:\Program Files\Haskell\bin Cabal-1.1.6.1... Setup.lhs: Error: Could not find module: Distribution.Compiler with any suffix: [hi] The magic commands are: runhaskell Setup.lhs configure runhaskell Setup.lhs build runhaskell Setup.lhs install -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/9/06, Alfonso Acosta [EMAIL PROTECTED] wrote: I've been using Data.Dynamic but the Typeable requirement doesn't go well with FFI declarations (which don't accept type contexts). Can you be a little more specific? mt2mgt :: MyType a b - MyGenType mt2mgt = MyGenType.myToDyn mgt2mt :: MyGentype - MyType a b mgt2mt (MyGenType dyn) = myfromDyn dyn The question is, ¿if only mt2mgt and mgt2mt are used by the user, would the use of unsafeCoerce be dangerous? mgt2mt . mt2mgt :: MyType a b - MyType c d Yes, it's dangerous. The reason Dynamic requires Typeable is to be able to check that you're casting Dynamic back to the original type. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic types through unsafeCoerce
On 12/9/06, Alfonso Acosta [EMAIL PROTECTED] wrote: Functions like this one are not directy exportable myfunc :: (Tyeable a, Typeable b) = MyType a b ... Well, that's true. Then again, you can't export that type anyway without use of a StablePtr. All StablePtrs are exportable. Uhm thinking about it right now I realized that mgt2mt is hidden to the user, so I guess it wouldn't be dangerous if transformations like the following one are not. MyType Int Char --- MyGenType MyType a b So to summarize, Is transforming a monomorphic type to it's polymorphic equivalent through unsafeCoerce a dangerous operation? Sure it is. The type you gave (MyType Int Char - MyType a b) can easily crash your program. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] interval arithmetic for integers?
On 12/8/06, Nicolas Frisby [EMAIL PROTECTED] wrote: I did see that one on the wiki; but it doesn't seem to support the open intervals (i.e. (-inf, 3)) and I'd really like those. Oh, it does. See BoundaryAboveAll and BoundaryBelowAll. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] interval arithmetic for integers?
Some of that is in the Ranged Sets library: http://ranged-sets.sourceforge.net/Ranged/ but it doesn't support Num. On 12/8/06, Nicolas Frisby [EMAIL PROTECTED] wrote: I'm looking to not reinvent the wheel. Is there an existing package that supports interval arithmetic on integers (or more)? A possible complication is that I'm hoping to include open intervals such as (GreaterEqThan 3). -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (a - [b]) - [a - b] ?
On 12/4/06, Joachim Breitner [EMAIL PROTECTED] wrote: \g - map (\n a - g a !! n) [1..] I think that's about as good as it gets. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Generate 50 random coordinates
On 12/2/06, Huazhi (Hank) Gong [EMAIL PROTECTED] wrote: myrand :: Int myrand = randomRIO(1::Int, 100) rf=[(myrand, myrand) | a - [1..50]] do let myrand = randomRIO (1 :: Int, 100) rf - replicateM 50 (liftM2 (,) myrand myrand) -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional GUI combinators for arbitrary graphs of components?
On 12/1/06, Brian Hulley [EMAIL PROTECTED] wrote: This problem is so general (ie converting a cyclic graph into an expression tree such that each node appears no more than once) that I'm sure someone somewhere must already have determined whether or not there can be a solution, though I don't know where to look or what to search for. I suggest you check the Functional Graph Library (FGL). It's shipped as part of GHC. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get subset of a list?
On 11/30/06, Huazhi (Hank) Gong [EMAIL PROTECTED] wrote: Thanks, it make sense here. However, like I want to choose s[1,3,6,10] or something like this. Are there some straightforward function or operator for doing this job? The !! operator in haskell seems does not support multiple indecies. If you're trying to do random access on a list, you should rethink why you're using a list. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Draft MissingH Reorg Plan
On 12/1/06, Tomasz Zielonka [EMAIL PROTECTED] wrote: Do you accept contributions? I have some code I find very useful that would fit in the same places, like in Text.ParserCombinators.Parsec.Utils, Data.BitsUtils (btw, why not Data.Bits.Utils?), Control.Concurrent.*. Hey, contributions. I'll throw in my haskell MIME parser if you want it. It's not the same as the one that most people use -- but I like it better. :) -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] strange type mismatch when trying to use takusen
On 11/23/06, Seth Gordon [EMAIL PROTECTED] wrote: takusen-test.hs:11:57: Couldn't match expected type `forall mark. DBM mark Session a' against inferred type `DBM mark sess ()' In the second argument of `($)', namely `main'' In the expression: (withSession (connect [CAdbname template1])) $ main' In the expression: do (withSession (connect [CAdbname template1])) $ main' Ah, the dreaded $ with existential types problem. $ is not quite equivalent to application -- the type checker does something funny with forall types. Just take out the $ and you'll be fine. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Re[2]: [Haskell] Proposal: unification of style of function/data/type/class definitions
On 9/11/06, Bulat Ziganshin [EMAIL PROTECTED] wrote: Expr Bool = Eq (Expr t) (Expr t) | forall t . Eq t Still confusing, but less so. The problem is that it's really backwards. The symbol being defined is Eq. Eq (Expr t) (Expr t) | Eq t = Expr Bool but that doesn't fit well, does it? In my mind, the current mode is a functional one: Eq :: Eq t = Expr t - Expr t - Expr Bool And this is perfectly readable. The arrow means that the argument is an implicit propositional one, but it's still an argument. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re[2]: [Haskell] Proposal: unification of styleof function/data/type/class definitions
On 9/11/06, Brian Hulley [EMAIL PROTECTED] wrote: data Expr t = If (Expr Bool) (Expr t) (Expr t) Expr Bool = Eq (Expr t) (Expr t) | Eq t Expr Int = Lit Int Meh. I'm still not big on it, since in a normal function, the guard is based on a variable in scope. Type signatures have implicit variables. Also, there's no way for the guard to fall through or anything like that. It's just not similar enough for me. -- Taral [EMAIL PROTECTED] You can't prove anything. -- Gödel's Incompetence Theorem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Lazy read
On 2/16/06, Neil Mitchell [EMAIL PROTECTED] wrote: What is the best way to modify the code to have read operate lazily? Is there any method that doesn't require writing a custom parser? Is there any standard way for solving a problem like this? Honestly, don't use read. It's icky. Check out ReadP or parsec, they are far superior in general. I think there was a suggestion of replacing Read with ReadP? -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why is $ right associative instead ofleftassociative?
On 2/6/06, John Hughes [EMAIL PROTECTED] wrote: The trouble with monad comprehensions was that it became far too easy to write ambiguous programs, even when you thought you were just working with lists. Would the Haskell98-style solution be to add defaulting for Monads? -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why is $ right associative instead of left associative?
On 2/4/06, Brian Hulley [EMAIL PROTECTED] wrote: Does anyone know why this strange associativity was chosen? I think it's very natural. Everything after the $, including other $ expressions, is applied to the stuff before the $. This saves me from a lot of nested parentheses. It seems to be that the left-associative version of $ does not decrease nesting level so effectively. -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell to call Microsoft COM (Dispatch)
On 1/30/06, Gracjan Polak [EMAIL PROTECTED] wrote: Is there any library to make Haskell call Microsoft COM functions using Dispatch? E.g I don't need the full COM binary functionality, scripting is enough. Google didn't seem to find anything interesting... beside rolling my own using FFI :) A bit of searching turns up very little, but rolling your own for simple support is not difficult. OleInitialize, CoCreateInstance, class IUnknown, class IDispatch, class Variant... -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unary pattern matching
On 1/26/06, Donald Bruce Stewart [EMAIL PROTECTED] wrote: Something like pattern guards? f x | Just _ - x = putStrLn something These subsume pattern guards... -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] Simple IO Regions
On 1/18/06, Keean Schupke [EMAIL PROTECTED] wrote: It didnt when I wrote the MonadIO stuff that I use! Here is the missing file ... I tried to put it all in one, but missed the use of up3. (see attached) All I see is up3 = undefined... somehow I don't think that will work. As far as I know, (t m a - m a) is only possible for very specific monad transformers... -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] Simple IO Regions
On 1/18/06, Keean Schupke [EMAIL PROTECTED] wrote: up3 is quite easy to define, but it is specific to the monad-transformer you are lifting through... see attached for definition for the state-monad-transformer. Ah, you're using undefined for the state. If you're going to do that, though, why not just have the function provided in the inner monad, since the features of the transformer are not available? -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] Simple IO Regions
On 1/17/06, Keean Schupke [EMAIL PROTECTED] wrote: Just made a few modifications and thought it might be useful to people. I have rewritten the functions as liftR and bracketR over a MonadIO monad interface (allowing monad-transformers to be used). I'm sorry, but what is Lib.Monad.MonadT? How does up3 work? MonadIO exists in Control.Monad.Trans. -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Intersection types for Haskell?
On 1/10/06, Brian Hulley [EMAIL PROTECTED] wrote: Hi - I'm wondering if there is any possiblility of getting intersection types into Haskell. For example, at the moment there is no (proper) typing for: f g x y = (g x, g y) Ideally, I'd like to be able to write: f:: (a - b c - d) - a - c - (b,d) I have no idea what kind of function would have type (a - b c - d). Can you give an example? f :: (a - b a) - c - d - (b c, b d) f :: (forall a. a - b a) - c - d - (b c, b d) -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [darcs-conflicts] how to nicely implement phantom type coersion?
On 12/8/05, David Roundy [EMAIL PROTECTED] wrote: So is there some other approach that I can use for easily coercing phantom types based on runtime checks? Any suggestions? None here. Since H-M uses type unification to do type inference, you can't auto-create a program based on the inferred types around it. -- Taral [EMAIL PROTECTED] Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe