Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Attoparsec parser question (PICCA Frederic-Emmanuel)
2. help designing types for a gsl fit (PICCA Frederic-Emmanuel)
----------------------------------------------------------------------
Message: 1
Date: Thu, 1 Jun 2017 17:33:00 +0000
From: PICCA Frederic-Emmanuel
<[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] Attoparsec parser question
Message-ID:
<a2a20ec3b8560d408356cac2fc148e53bb37e...@sun-dag3.synchrotron-soleil.fr>
Content-Type: text/plain; charset="utf-8"
Hello Francesco
> maybe next time attach a simple .hs file which replicates the issue
> (with import modules, etc.), this way it is simpler to diagnose.
I will considere this next time.
> Just by scanning the code, this raises a red flag:
> > detectorP ∷ ToPyFAI a ⇒ a → Parser a
> > detectorP a = do
> > _ ← "Detector: " *> string (toPyFAI a) <* endOfLine
> > pure a
> "Detector: " is a plain String, so i guess putting a `string` before it
> (or whatever is needed) should solve the issue.
> Does that solve the problem?
I solved my problem doing something else, but thanks for your help.
thanks a lot
Fred
------------------------------
Message: 2
Date: Fri, 2 Jun 2017 06:04:44 +0000
From: PICCA Frederic-Emmanuel
<[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: [Haskell-beginners] help designing types for a gsl fit
Message-ID:
<a2a20ec3b8560d408356cac2fc148e53bb37e...@sun-dag3.synchrotron-soleil.fr>
Content-Type: text/plain; charset="us-ascii"
Hello
I imagine that I have two types A and B
I want to create a ADT
data C = C A B
1) the toGsl class
class ToGsl a where
toGsl :: a -> [Double]
this class allow to convert a type to a Vector of double in order to use gsl
for a fit
so I can create instance for A and B (I do not write the instance but the
result of the toGsl function)
A -> [a1, ... an]
B -> [b1, ... bm]
Now I want this to work also with C
C -> [a1..., an] ++ [b1, .... bm]
So the C instance is juste the (toGsl a) ++ (toGsl b)
Is there a way to write this generically for other type construct like (data D
= D C A) etc....
Functor, Applicative, Monoid ?
2) the fromGsl case
now the inverse method is
cladd FromGsl a where
fromGsl :: a -> [Double] -> a
so now the question is if I have a [Double], I need t osplit this list for
each composant of the ADT.
in the case of C
fromGSL (C a b) v = ...split the vector... and apply fromGsl to a and b
So my question is the symetic of the previous one.
Is it possible to create a generic function inorder to do this.
thanks for your help.
Frederic
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 108, Issue 1
*****************************************