Re: [Haskell-cafe] type class constraints headache

2010-03-03 Thread Rahul Kapoor
>I am trying to understand the mechanism behind -- > why does the first example compile and what constraints does > enumerateMethodNames add on a (which it does not inspect)? enumerateMethodNames does not add on any constraints. If you don't actually use "methods" GHC does not care what it's type

Re: [Haskell-cafe] type class constraints headache

2010-03-03 Thread Rahul Kapoor
> methods :: (Eq a) => [(String, a)] > methods = > [ ("method1", undefined ) > , ("method2", undefined) > ] > > enumerateMethodNames :: [String] > enumerateMethodNames = map fst methods The above does not compile because the source does not have enough information for GHC to determine what a

Re: [Haskell-cafe] Using Cabal during development

2010-02-09 Thread Rahul Kapoor
> Then how does the 'Executable' section of your .cabal look like? That's what > I can't get working. Suitably elided. Executable test hs-source-dirs: src, tests other-modules:Text.Yaml.Yay, Text.Yaml.Yay.Syck main-is: Main.hs build-depends:base, HsSyck,

Re: [Haskell-cafe] Using Cabal during development

2010-02-09 Thread Rahul Kapoor
> Okay, but have you ever felt the need to make in the same project a library > and an executable which depends on this library (even just like me, for > testing purpose)? How would you do it? Specifying the modules under test in other-modules section for the executable does the trick for me. I ca

Re: [Haskell-cafe] Stack ADT?

2010-02-05 Thread Rahul Kapoor
> What's going on here? I'm not even calling function POP. > *Data.Stack> let s2 = pop s1 > *Data.Stack> top s2 > *** Exception: Stack.hs:8:0-28: Non-exhaustive patterns in function pop Haskell being a non strict language, does not evaluate pop s1 when you define let s2 = pop s1. but when you try

Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Rahul Kapoor
> So, is there a way to get an application > directory path under Windows? I remember that there is a way to do this > using WinAPI, but how to do this Haskell? The System.Directory module has some methods to get specific directory names in an OS agnostic manner. The closest method that matches w

Re: [Haskell-cafe] Windows emulator for testing purposes

2010-01-18 Thread Rahul Kapoor
> Do you have any recommendations for a free/open source solution that would >let me emulate a Windows >environment for testing purposes? Sun's Virtual Box? - http://www.virtualbox.org/ You would still need a Windows license though. Cheers, Rahul ___

Re: [Haskell-cafe] What's going on here?

2010-01-16 Thread Rahul Kapoor
>>*Main> dropFirst [3 4 5 6] List members are separated by commas. Space in Haskell denotes function application. Hence the error message: Hence t > No instance for (Num (t -> t1 -> t2 -> Int)) > arising from the literal `3' at :1:11-17 > Possible fix: > add an instance declara

Re: [Haskell-cafe] Generating random enums

2009-05-02 Thread Rahul Kapoor
> OK, I think what you're saying is to work with (random) integers and use > fromEnum and toEnum to get corresponding DayOfWeek. But I get this when I > try to use toEnum: > > *Main> toEnum 2 ghci does not know what type of enum you want to create from the number 2. Try: toEnum 2 :: DayOfWeek Tha

Re: [Haskell-cafe] Enum to String, and back?

2009-04-15 Thread Rahul Kapoor
On Wed, Apr 15, 2009 at 3:13 PM, michael rice wrote: > Using Show it is possible to establish a relationship between an enum type > and a String type to display it. > Can one as easily establish a reverse relationship, i.e., convert a String > type like "Red" back to its corresponding Color type?

Re: [Haskell-cafe] Remote control of firefox through Haskell?

2008-07-15 Thread Rahul Kapoor
Selenium (http://selenium.openqa.org/) might do what you want. The bindings were announced on this list a little while ago (http://tinyurl.com/se-bindings) On Tue, Jul 15, 2008 at 3:12 PM, Jefferson Heard <[EMAIL PROTECTED]> wrote: > Is there a library out there that will allow me to remote-contro

Re: [Haskell-cafe] where to put handy functions?

2007-08-09 Thread Rahul Kapoor
On 8/9/07, Chad Scherrer <[EMAIL PROTECTED]> wrote: > Is there process for submitting functions for consideration for > inclusion into future versions of the standard libraries? For example, > I'd like to see this in Data.List: I imagine including it in std lib takes a while. Would it be a good id

[Haskell-cafe] Using HList Records

2007-08-08 Thread Rahul Kapoor
Using The Darcs version of HList (http://darcs.haskell.org/HList/), I can do simple things with (H)lists just fine, so --angus = Key 42 -- .*. Name "Angus" -- .*. Cow -- .*. Price 75.5 -- .*. HNil --main = putStrLn (show angus) works, On the other hand examples from the HList pa

[Haskell-cafe] combinators for a simple grammar

2007-08-06 Thread Rahul Kapoor
I am having problems coming up with nice combinators for a simple DSEL. The abstract syntax is simply given by the types: data SearchCondition = SearchCondition BoolTerm | OpOr SearchCondition BoolTerm data BoolTerm = BoolTerm BoolFactor | OpAnd BoolTerm BoolFactor data BoolFactor = Constant Bo

Re: [Haskell-cafe] Re: Type without a data constructor?

2007-08-06 Thread Rahul Kapoor
>> Constructors and names of data types live in separate namespaces. The above fact was the cause of all my confusion. It just slipped out of my mind. Cheers, Rahul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/li

[Haskell-cafe] Type without a data constructor?

2007-08-06 Thread Rahul Kapoor
Most examples for defining algebraic types include data constructors like so: data Tree a = Tip | Node a (Tree a) (Tree a) I by mistake defined a type which did not specify a data constructor : data SearchCondition = Term Bool | SearchCondition :||: (Term Bool) data Term a = Constant a sc :: Se

[Haskell-cafe] problems installing Takusen-0.6

2007-07-28 Thread Rahul Kapoor
I am having problems installing Takusen-0.6 (ghc 6.6.1 on FreeBSD) The configure and build works fine. running ./setup install fails with: Installing: /usr/local/lib/Takusen-0.6/ghc-6.6.1 & /usr/local/bin Takusen-0.6... setup: Error: Could not find module: Database.Oracle.Enumerator with any suff