Anyone ever needed this? Me and John Wiegley were discussing a decent
name for it, John suggested inv as in involution. E.g.
inv reverse (take 10)
inv reverse (dropWhile isDigit)
trim = inv reverse (dropWhile isSpace) . dropWhile isSpace
That seems to be the only use-case I've ever come across.
On 17 August 2013 19:11, Christopher Done chrisd...@gmail.com wrote:
Anyone ever needed this? Me and John Wiegley were discussing a decent
name for it, John suggested inv as in involution. E.g.
In terms of a decent name: as soon as I saw the subject, I thought you
were somehow inverting a
On 17/08/13 10:11, Christopher Done wrote:
Anyone ever needed this? Me and John Wiegley were discussing a decent
name for it, John suggested inv as in involution. E.g.
First thing I thought was ‘inverse’…
inv reverse (take 10)
inv reverse (dropWhile isDigit)
trim = inv reverse (dropWhile
In J (a sort of dialect of APL), there's a thing called under, written
.. The expression (f . g) x is equivalent to (g^:_1) (f (g x))
where g^:_1 is J's obverse of g, which in cases where it exists is
usually the inverse of g (
http://www.jsoftware.com/help/dictionary/intro26.htm). Abusing
damodar kulkarni kdamodar2...@gmail.com writes:
Thanks for this nice analogy and explanation. This brings monad
transformers to my mind.
without monad transformers, the monads are bit crippled in their
applicability (please correct me if I am wrong)
and
with monad transformers the code
On Sat, Aug 17, 2013 at 11:11:07AM +0200, Christopher Done wrote:
Anyone ever needed this? Me and John Wiegley were discussing a decent
name for it, John suggested inv as in involution. E.g.
inv reverse (take 10)
inv reverse (dropWhile isDigit)
trim = inv reverse (dropWhile isSpace) .
Note that at least for the dropWhile example, there is a specialized
function, dropWhileEnd, which is most likely more efficient than reversing
the list twice.
On Aug 17, 2013 3:35 PM, Tom Ellis
tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote:
On Sat, Aug 17, 2013 at 11:11:07AM +0200,
Hi,
Am Samstag, den 17.08.2013, 11:11 +0200 schrieb Christopher Done:
inv reverse (take 10)
if you want that fast and lazy, check out
http://www.joachim-breitner.de/blog/archives/600-On-taking-the-last-n-elements-of-a-list.html
Greetings,
Joachim
--
Joachim “nomeata” Breitner
Christopher Done chrisd...@gmail.com writes:
Anyone ever needed this? Me and John Wiegley were discussing a decent
name for it, John suggested inv as in involution. E.g.
inv reverse (take 10)
inv reverse (dropWhile isDigit)
trim = inv reverse (dropWhile isSpace) . dropWhile isSpace
That
Hello,
I've a problem connecting to my postgresql database.
Can You help me fix the ambigious type signature?
(The example is identical to the first 5-liner-example in the package
documentation)
On Sat, Aug 17, 2013 at 8:23 AM, Mathijs Kwik math...@bluescreen303.nlwrote:
damodar kulkarni kdamodar2...@gmail.com writes:
Thanks for this nice analogy and explanation. This brings monad
transformers to my mind.
without monad transformers, the monads are bit crippled in their
On Sat, Aug 17, 2013 at 1:35 PM, Hartmut Pfarr
hartmut0...@googlemail.comwrote:
(The example is identical to the first 5-liner-example in the package
documentation)
As I read it, the example has a typo: it should be using `query_` instead
of `query`. See
This is indeed a job for lens, particularly, the Iso type, and the under
function. Lens conveniently comes with a typeclassed isomorphism called
reversed, which of course has a list instance.
under reversed (take 10) ['a'.. 'z']
qrstuvwxyz
-- Dan Burton
On Aug 17, 2013 10:23 AM, Anton Nikishaev
The lens docs even have an example of another helper function, involuted
for functions which are their own inverse.
live involuted reverse %~ ('d':)
lived
inv f g = involuted f %~ g
http://hackage.haskell.org/packages/archive/lens/3.9.0.2/doc/html/Control-Lens-Iso.html#v:involuted
-- Dan
Thx, I changed now from query to query_
Now the coding is like that:
{-# LANGUAGE OverloadedStrings #-}
import Database.PostgreSQL.Simple
import Database.PostgreSQL.Simple.FromRow
hello :: (FromRow a) = IO [a]
hello = do
On Sat, Aug 17, 2013 at 11:59:24PM +0200, Hartmut Pfarr wrote:
{-# LANGUAGE OverloadedStrings #-}
import Database.PostgreSQL.Simple
import Database.PostgreSQL.Simple.FromRow
hello :: (FromRow a) = IO [a]
hello = do
conn - connect defaultConnectInfo
query_ conn select 2 + 2
Either
On Sat, Aug 17, 2013 at 5:59 PM, Hartmut Pfarr
hartmut0...@googlemail.comwrote:
query_ conn select 2 + 2
I've no errors any more.
But: I don't see any result (for sure, it is not coeded yet)
Yes, because you're not capturing it; it's the return value from `query_`,
which you are throwing
Dan Burton danburton.em...@gmail.com writes:
under reversed (take 10) ['a'.. 'z']
qrstuvwxyz
Excellent, thanks!
--
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com johnw on #haskell/irc.freenode.net
Q: Are the continuations in Scheme related to the monads from
Haskell? If so, could someone elaborate on that?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Yes they are. Purely intuitively, you can see how writing code in a monadic
style (using = a lot) is very similar to writing in continuation-passing
style.
You can express this the most directly with the continuation monad. Then,
from this monad, you can express other monads. In some sense, the
... thx all for helping. Now the coding works: it puts the following out.
Kind regards
Hartmut
*Main main
Only {fromOnly = 4}
--
Only {fromOnly = 101}
Only {fromOnly = 102}
Only {fromOnly = 103}
--
blub 101 51
blub 102 52
blub 103 53
The
21 matches
Mail list logo