Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/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. Thames Valley functional meetup (Courtney Robinson)
2. Re: Thames Valley functional meetup (Kim-Ee Yeoh)
3. RPC library / generic application level protocol
(Emanuel Koczwara)
4. Re: backtracking search and memory usage (Dennis Raddle)
5. Capture the notion of invertible functions (Javran Cheng)
----------------------------------------------------------------------
Message: 1
Date: Sun, 16 Mar 2014 12:03:03 +0000
From: Courtney Robinson <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Thames Valley functional meetup
Message-ID:
<CAGo6xJZPoLNHqkUE=fb4hfv9wf1qtud6f5iozo5xfeojnu-...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello all,
For anyone in the Thames valley area (UK) interested in a more local
functional meetup.
We've just started one. It's available at
http://www.meetup.com/Thames-Valley-Functional-Programming-Meetup/
We'll be covering Haskell and a host of other functional languages in the
talks.
Already got the first one lined up for Haskell, Scala and OCaml (to be
confirmed).
See
http://www.meetup.com/Thames-Valley-Functional-Programming-Meetup/events/171168272/
Hope to see you there.
--
Courtney Robinson
[email protected]
http://crlog.info
07535691628 (No private #s)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140316/4989253e/attachment-0001.html>
------------------------------
Message: 2
Date: Sun, 16 Mar 2014 20:34:00 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Thames Valley functional meetup
Message-ID:
<CAPY+ZdSamwEN0VasTr-6HNh7oZf7J=c2yjCQMymwGncGyKe=d...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Sun, Mar 16, 2014 at 7:03 PM, Courtney Robinson <[email protected]>wrote:
> For anyone in the Thames valley area (UK) interested in a more local
> functional meetup.
> We've just started one.
>
Afaict, the haskell-beginners list is way smaller than haskell-cafe so it's
worth re-sending to the latter.
Also reddit /r/haskell is a good place too, just ignore the downvotes.
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140316/65496734/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 16 Mar 2014 18:32:36 +0100
From: Emanuel Koczwara <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] RPC library / generic application level
protocol
Message-ID: <1394991156.20062.47.camel@emanuel-laptop>
Content-Type: text/plain; charset="UTF-8"
Hi,
I have an application in c++/qt (https://gitorious.org/micropos). Direct
connection with PostgreSQL is a big security hole, so I'm trying to
redesign my architecture. I want to add an application server between
PostgreSQL and client/admin and I want to write that application in
Haskell.
The core concept of my new architecture is a custom protocol. With that,
it would be possible with little effort to create web and mobile
clients, possibly using different technologies.
Totally custom protocol would be interesting, but writing a parser for c
++ _and_ python _and_ java (and haskell of course) will be too much for
me at the moment. XML-RPC looks too heavy, so I ended up with JSON-RPC
('id' attribute is ommited):
* authentication example:
| > { method: "auth-login", params: { name: <name>, passwd: <passwd> } }
| < { result: <status-object> }
| > { method: "auth-logout", params: null }
| < { result: <status-object> }
* uploading/downloading binary data/files example:
| > { method: "fs-upload", params: <binary-data> }
| { result: <status-object> }
| > { method: "fs-download", params: <binary-data-id> }
| < { result: <status-object> }
* low level generic database methods:
| > { method: "db-create", params: { type: <type>, object: <object> } }
| < { result: <status-object> }
| > { method: "db-update", params: { type: <type>, object: <object> } }
| < { result: <status-object> }
| > { method: "db-delete", params: { type: <type>, id: <id> } }
| < { result: <status-object> }
| > { method: "db-list", params:
| { type: <type>,
| filter-by: [ <predicate-objects> ],
| order-by: [ <ordering-objects> ] } }
| < { result: [ <ids> ] }
| > { method: "db-show", params:
| { type: <type>,
| ids: [ <ids> ],
| fields: [ <fields-options-objects> ] } }
| < { result: [ <objects> ] }
| > { method: "db-list-show", params:
| { type: <type>,
| filter-by: [ <predicate-objects> ],
| order-by: [ <ordering-objects> ],
| fields: [ <fields-options-objects> ] } }
| < { result: [ <objects> ] }
* low level generic relations:
| > { method: "db-insert", params:
| { group-type: <type>,
| group-id: <id>,
| member-type: <type>,
| members: [ <ids> ] } }
| < { result: <status-object> }
| > { method: "db-remove", params:
| { group-type: <type>,
| group-id: <id>,
| member-type: <type>,
| members: [ <ids> ] } }
| < { result: <status-object> }
Example usage (this should add a record in 'client' table):
| > { method: "db-create", params:
| { type: client,
| object:{ name:"John Doe", address: "...", ... } } }
| < { result: <status-object> }
This 'parsing engine' should be generated from some kind of 'routes
description' like in django, rails or yesod. For example something like
this:
| auth-login (user-name :: String) (user-password :: String)
| auth-logout
| auth-lock
| auth-unlock (user-name :: String) (user-code :: String)
| fs-upload (binary-data :: BinaryData)
| fs-download (binary-data-id :: BinaryDataId)
| db-create (type :: String) (object :: a)
| db-update (type :: String) (object :: a)
| db-delete (type :: String) (id :: String)
The user should supply all data definitions and conversion functions to
guarantee type corectness in case of a match, for example:
class FromJson a where
fromJson :: String -> Maybe a
data Client = Client { name :: String, address :: String, ... }
instance FromJason Client where
fromJson = ...
This looks very generic. Am I reinventing the wheel? Which package
should I use for this task? msgpack-rpc looks interesting. Other
packages have very low download rate. Or maybe there is some kind of
generic appliaction server (but I'm looking for tcp/ip level, no http)?
Any hints are very welcome.
Thanks,
Emanuel
------------------------------
Message: 4
Date: Sun, 16 Mar 2014 14:25:06 -0700
From: Dennis Raddle <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] backtracking search and memory usage
Message-ID:
<cakxlvopgwmhx86pjwb+aa+_ar1r4+xav4oadk7x0v++q7xc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
thanks, that's some great perspective. I love how computer scientists think
generally like that. I have several specific problems in mind and in those
problems, the backtracking state is always built by adding pieces and never
taking them away,and a full solution always requires the same number of
pieces. So basically there isn't an opportunity for loops to form.
Your advice to narrow the scope and build something that runs before
worrying about performance issues is good advice, advice I would probably
give myself or a younger programmer at times, but a lesson I still need to
learn in other ways.
Mike
On Sat, Mar 15, 2014 at 9:08 AM, Kim-Ee Yeoh <[email protected]> wrote:
> Let's look at the requirements for this problem, uncovering some of the
> unspoken ones:
>
> 1. very general problem
> 2. fast, or at least not too slow
> 3. memory-efficient
> 4. correct
>
> Leaving aside performance issues 2 and 3, is it possible that 1 and 4
> alone are enough to deliver plenty of heartburn?
>
> I can think of at least one class of problems: the enumeration and
> application of choices lead to cyclical states. Hence resulting in a list
> of solutions pockmarked with bottoms.
>
> I mean your backtrack function is a correct and succinct description of
> the very notion of backtracking. The devil is in the details of state
> design, including the enumeration and application issues I've described.
>
> By narrowing the scope of the problem so that you first obtain a library
> that correctly solves it, you could then focus on performance issues.
>
>
> -- Kim-Ee
>
>
> On Sat, Mar 15, 2014 at 9:06 AM, Dennis Raddle <[email protected]>wrote:
>
>> I want to implement backtracking search, but I wonder if I'm going to
>> immediately run into memory usage problems if I don't use strict evaluation
>> somewhere. I'm very hazy on how to implement strict evaluation. I'm
>> thinking of creating a generic algorithm that looks something like the
>> following.
>>
>> We have the concept of a data construct that can be built step by step.
>> At each step are choices. We are investigating all the choices and finding
>> series of choices that lead to a completed data construct or "solution." We
>> want to generate a list of all solutions.
>>
>> (My Haskell syntax is rusty so there may be errors in the following.)
>>
>>
>> class Construct a where
>> enumerateChoices :: a -> [b]
>> applyChoice :: a -> b -> a
>> isSolution :: a -> Bool
>>
>> backtrack :: Construct a => a -> [a]
>> backtrack c
>> | isSolution c = [c]
>> | otherwise =
>> concat . map (backtrack . applyChoice c) . enumerateChoices $ c
>>
>> So my question is whether this is going to use a lot of memory to run,
>> maybe by holding all partially solved data? Where would strict evaluation
>> go?
>>
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140316/1966e90b/attachment-0001.html>
------------------------------
Message: 5
Date: Mon, 17 Mar 2014 03:44:11 -0400
From: Javran Cheng <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Capture the notion of invertible
functions
Message-ID:
<ca+tfdnyd42och_vnuahsayd+fh8owzwqvurcy3pt4swspza...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
These days I find the notion of "inverse function" might be useful,
the basic idea is to keep a pair of function f and g which are the inverse
functions of each other
and then manipulate on this pair of functions.
The detail is both on my blog post:
http://javran.github.io/posts/2014-03-17-capture-the-notion-of-invertible-functions.html
and also code review:
http://codereview.stackexchange.com/questions/44550/capture-the-notion-of-invertible-functions
I think this is an interesting idea and want to share it with you.
Advice and comments are welcomed and appreciated since I learn haskell
through LYAH and some wiki pages
and still not sure about what would be the most idiomatic way of doing it
in haskell.
Thanks,
--
Javran (Fang) Cheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140317/42478dfd/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 69, Issue 21
*****************************************