[Haskell-cafe] open datatypes

2011-02-16 Thread rodrigo.bonifacio
Dear all, Supposing that I have a FlowObject datatype such as:data FlowObject = Activity { ...  }  | Start | End | Proceed | ...I could make "open" this datatype by refactoring this definition through a type class + one datatype for each kind of FlowObject. Such as:data Activity = Activity { ...

[Haskell-cafe] Profiling

2010-04-20 Thread rodrigo.bonifacio
Dear all, I am trying to compile a project with the "-prof -auto-all" profile options. But the compiler returns: "Could not find module `Text.ParserCombinators.Parsec.Language':Perhaps you haven't installed the profiling libraries for package `parsec-3.1.0'?Use -v to see a list of the

[Haskell-cafe] Distinct types in a list

2010-01-07 Thread rodrigo.bonifacio
Hi all, I have a family of parsers that return either (Success t) or (Fail), using the following data type: data ParserResult a = Success a | Fail String deriving (Read, Show, Eq, Ord) isSuccess (Success _) = True isSuccess (Fail _) = False ... I want to add the results of different

[Haskell-cafe] lhs2tex + pretty print

2009-12-10 Thread rodrigo.bonifacio
Dear all, I want to call a function "f :: Scenario - Doc", using lhs2tex, that returns a Doc of the HughesPJ pretty print library. The returning Doc is embedded with Latex syntax. I mean, calling (show f s) returns some thing like: "\\subsubsection*{Scenario sc01}\n\\begin{itemize}\n\\item "

Re: [Haskell-cafe] Existencial Types

2009-12-03 Thread rodrigo.bonifacio
...@gmail.com escreveu: On Tue, Dec 1, 2009 at 4:21 PM, rodrigo.bonifacio wrote: Thanks Luke. In fact I, will have different implementations of the Transformation type. Something like: data SelectScenarios = SelectScenarios { scIds :: [Id] } What is this different type buying you? You can

[Haskell-cafe] Existencial Types

2009-12-01 Thread rodrigo.bonifacio
Dear all, I wrote the following  types: class Transformation t where   (+) :: t - SPLModel  - InstanceModel - InstanceModel data Configuration = forall t . Transformation t = Configuration (FeatureExpression, [t]) type ConfigurationKnowledge = [Configuration]   I tried to write a function that

Re: [Haskell-cafe] Existencial Types

2009-12-01 Thread rodrigo.bonifacio
about it? instance Transformation SelectScenario where (+)    Regards, Rodrigo.           Em 01/12/2009 19:39, Luke Palmer lrpal...@gmail.com escreveu: On Tue, Dec 1, 2009 at 11:21 AM, David Menendez wrote: On Tue, Dec 1, 2009 at 1:00 PM, rodrigo.bonifacio wrote: Dear all, I wrote

[Haskell-cafe] Scrap your boilerplate traversals

2009-11-25 Thread rodrigo.bonifacio
Hi all, Is there a non-recursive traversal defined in Data.Generics' modules? I mean, the everywhere traversal first applies a function "f" to the subterms, and then applies "f" to the result. I am wondering if do exists a traversal that applies f only to the subterms. Thanks in advance, Rodrigo.  

[Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

2009-04-14 Thread rodrigo.bonifacio
Dear Sirs, I guess this is a very simple question. How can I convert IO [XmlTree] to just a list of XmlTree? Regards, Rodrigo.   ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] HXT + Segmentation Fault

2009-02-12 Thread rodrigo.bonifacio
Hi all, I'm trying to parse some XML files using HXT. However, even the examples available on the twiki fail. I guess that the problem is related to some library version, but I'm not sure. The error reported is: Segmentation fault. Thanks in advance. Compiling with GHC-6.8.3 running on

[Haskell-cafe] Converting Lists to Sets

2009-02-03 Thread rodrigo.bonifacio
Hi all, I'm trying to use the Funsat library. One of its data types is CNF: data CNF = CNF { numVars :: Int numClauses :: Int clauses :: Set Clause } I have a list of clauses, but I'm getting an error when converting such a list to a Set. Using the fromList function, the ghc compiler

[Haskell-cafe] Error building Sdf2Haskell

2009-01-12 Thread rodrigo.bonifacio
Hi all, I'm trying to build the Sdf2Haskell library. However, I've got the following problem: Making all in generatorlocate: illegal option -- nusage: locate [-0Scims] [-l limit] [-d database] pattern ...default database: `/var/db/locate.database' or $LOCATE_PATHmake Sdf.tbllocate: illegal option

[Haskell-cafe] data, util, and lang packages

2009-01-12 Thread rodrigo.bonifacio
Hi all, I'm trying to build a library whose configuration process requires the data, util, and lang packages. I guess that these are *deprecated* packages, since the library is said to be ghc 6.4.1 compliant. Which packages should I use instead? Where can I find such packages (if they are not

[Haskell-cafe] A pattern type signature cannot bind scoped type variables `t'

2009-01-12 Thread rodrigo.bonifacio
Hi all, I'm trying to build a library that has the following code: hasTypeOf (TermRep (dx,_,_)) (x::t) = ((fromDynamic dx)::Maybe t)   When I try to compile with ghc-6.8.3 I got the following error: ../../StrategyLib/models/drift-default//TermRep.hs:63:30: A pattern type signature cannot bind

[Haskell-cafe] Getting module functions

2008-07-11 Thread rodrigo.bonifacio
Hi all, Is there any function that can be used for retrieving the exposed functions of a given module? Thanks, Rodrigo. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Mutual recursive data types

2008-04-29 Thread rodrigo.bonifacio
Hi all, I have the following data types: type Id = String type Action = String type State = String type Response = String data Scenario = Scenario Description [Step] data Step = Step Id Scenario Action State Response So, there is a mutual recursion between Scenario and Step. Now, consider the

Re: [Haskell-cafe] Processing XML with HXT

2008-04-23 Thread rodrigo.bonifacio
Hi Uwe Schmidt, thanks a lot. Just one more question, I didn't find any example describing how to get the text information of a XML element in the picklers tutorial. So, if the use case element is described as follwing: useCase idUC_01/id nameOpening .../name descriptionThis use case

[Haskell-cafe] Processing XML with HXT

2008-04-22 Thread rodrigo.bonifacio
Hi all, I´m just starting with HXT. My question is, how can I expose a use case from the main function below (the XmlPickler for UseCase has been already defined): main :: IO () main = do runX ( xunpickleDocument xpUseCase [ (a_validate,v_0) ], uc.xml ) return () For example, if I

[Haskell-cafe] Installing HaXml

2008-04-15 Thread rodrigo.bonifacio
Hi all, I've tried to install HaXml as explained in the documentation: runhaskell Setup.hs configure However, I get as response: dyld: Library not loaded: GNUreadline.framework/Versions/A/GNUreadline Referenced from: /usr/local/bin/runhaskell Reason: image not found Trace/BPT trap Any

Re: [Haskell-cafe] QuickCheck

2008-03-17 Thread rodrigo.bonifacio
Hi all, Is it possible to define a limit for the size of children list bellow? I've tried: children - resize (10 (listGen featureGenNormal)) But it didn't work. Thanks a lot, Rodrigo. Sebastian Sylvan: featureGenNormal = do id - stringGen name - stringGen featuretype -

[Haskell-cafe] QuickCheck

2008-03-16 Thread rodrigo.bonifacio
Hi all, I'm trying to use the quick-check library for checking some properties of a user defined data type. Bellow the target data type: data Feature = Feature Id Name FeatureType GroupType Children Properties | FeatureError where: Id = String Name = String FeatureType = int GroupType = int

Re: [Haskell-cafe] QuickCheck

2008-03-16 Thread rodrigo.bonifacio
Dear Sebastian Sylvan, Thanks for your datailed answer. It saved me a lot of time. Best regards, Rodrigo. On Sun, Mar 16, 2008 at 5:42 PM, rodrigo.bonifacio [EMAIL PROTECTED] wrote: Hi all, I'm trying to use the quick-check library for checking some properties of a user defined

[Haskell-cafe] Basic question....

2007-08-17 Thread rodrigo.bonifacio
Hi all. I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried the following: type Key = String data EnvItem a = EnvItem (Key, a) envKey :: EnvItem (Key, a) - String envKey EnvItem (key, value) = key envValue ::

[Haskell-cafe] Defining new operators

2007-08-10 Thread rodrigo.bonifacio
Hi all, Given the follwing function: owner :: Step - Scenario owner (Step id scenario action state response) = scenario Is it possible to define the owner function in such way that I can write x.owner (returning the scenario related with the Step x)? Thanks in advance, Rodrigo.

[Haskell-cafe] New Eq instance

2007-08-09 Thread rodrigo.bonifacio
Hello, I had defined the follwing data type: data Step = Step Id Scenario Action State Response How can I define Step as an Eq Instance, in such way that two steps are equals if they have the same Id (Id is defined as a synonimous for the String type). I tried the following code, but

[Haskell-cafe] mutually recursive types

2007-08-08 Thread rodrigo.bonifacio
Hi, I am learning the haskell programming language and had tried to define the following types: type Scenario = (String, String, [Step]) type Step = (String, Scenario, String, String, String) Notice that Scenario depends on a list of steps and Step has a dependence with scenario. I know that

[Haskell-cafe] Defining new operators

2007-08-08 Thread rodrigo.bonifacio
Hello, I have created the following function: dist :: String - [[String]] - [[String]] dist x y = [ x:e | e-y ] eg.: dist 1M [[], [2M], [2M, 3M]] = [[1M],[1M,2M],[1M,2M, 3M]] How can I create an operator that perform the same function as dist? I want to write something like: 1M ++ [[],