Mercurial > repo
view paste/paste.17882 @ 3599:13c382349b6b
<Phantom_Hoover> echo "* oerjan swats quintopia -----###" >> bdsmreclist
author | HackBot |
---|---|
date | Mon, 02 Sep 2013 22:05:47 +0000 |
parents | 964d6cdb2609 |
children |
line wrap: on
line source
2008-02-21.txt:22:54:08: <oerjan> that is: fmap fst (minViewWithKey . snd . split currentLineNo $ currentProgram). i think. 2008-06-07.txt:04:25:30: <augur> positive == return, happy == fmap? 2008-06-07.txt:04:26:14: <augur> happy is fmap i think 2008-06-07.txt:04:27:58: <augur> happy has to be fmap 2008-06-07.txt:04:29:32: <augur> fmap is (a -> b) -> f a -> f b 2008-06-07.txt:04:29:46: <augur> fmap is (a -> b) -> f a -> f b 2008-10-26.txt:00:12:07: <Asztal> I think it definitely makes things more readable in the case of things like `isPrefixOf` and maybe `fmap` 2009-02-16.txt:17:25:38: <ehird> > loeb x = fmap (\a -> a (loeb x)) x 2009-02-27.txt:18:15:46: <ehird> 18:15 ehird: @pl fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-02-27.txt:18:15:46: <ehird> 18:15 lambdabot: fmap (fmap (fmap fmap)) fmap 2009-02-27.txt:18:15:50: <ehird> fmap calculus 2009-02-27.txt:18:16:25: <ais523> what does fmap do? 2009-02-27.txt:18:16:37: <ehird> 18:15 ehird: :t fmap 2009-02-27.txt:18:16:38: <oerjan> adding 4 fmaps gives the same after a while 2009-02-27.txt:18:16:49: <ehird> for which fmap = (.) 2009-02-27.txt:18:17:00: <ehird> for which fmap = map 2009-02-27.txt:18:17:17: <ehird> ideally, map and (.) wouldn't exist and fmap would be called (.) 2009-02-27.txt:18:17:54: <oerjan> fmap = liftM for monads 2009-02-27.txt:18:18:04: <ehird> lambdabot used to have (.) as fmap 2009-02-27.txt:18:18:58: <ehird> 18:17 HugoDaniel has left IRC ("fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap vim") 2009-02-27.txt:18:19:41: <ehird> ehird: @. type pl fmap . fmap . fmap fmap fmap fmap (fmap . fmap fmap) . fmap fmap fmap 2009-03-24.txt:17:08:31: <ehird> "Or even how to implement Haskell's ap/<*> (translated painstakingly to Java) in terms of fmap, return, and join (this is legally considered torture in 49 states)" 2009-04-10.txt:20:58:46: <Deewiant> ehird: fmap (Const . read) (many1 digit) 2009-05-15.txt:20:28:14: <Deewiant> findFixPoint f = fmap snd . find (uncurry (==)) . (zip `ap` tail) . iterate f 2009-06-23.txt:20:36:36: <ehird> @pl \x -> foo `fmap` bar x 2009-06-23.txt:20:36:37: <lambdabot> (foo `fmap`) . bar 2009-06-24.txt:15:18:37: <Warrigal> <*> looks like fmap. 2009-06-24.txt:15:22:31: <Warrigal> s/map/fmap/ 2009-06-24.txt:15:27:09: <lambdabot> f <$> a = fmap f a 2009-06-24.txt:15:27:28: <Warrigal> Woo, it's fmap. 2009-06-24.txt:18:00:14: <ehird> pikhq: also, "fmap" is both (.) and map, for functions and lists 2009-06-24.txt:18:00:16: <ehird> > fmap succ [1,2,3] 2009-06-24.txt:18:00:23: <ehird> > fmap (fmap succ succ) [1,2,3] 2009-06-24.txt:19:15:27: <oerjan> l >>= f = join (fmap f l) 2009-06-24.txt:19:16:12: <oerjan> fmap = map, since the functor instances agree (parametricity makes it hard/impossible to have more than one Functor instance) 2009-06-24.txt:19:16:32: <Gracenotes> I'm pretty sure fmap [] has one sane instance :) 2009-06-25.txt:16:31:39: <ehird> :t fmap 2009-06-25.txt:16:31:51: <ehird> but that's what fmap is :P 2009-06-25.txt:16:36:58: <ehird> @src (->) fmap 2009-06-25.txt:16:36:58: <lambdabot> fmap = (.) 2009-06-25.txt:16:38:20: <pikhq> I know you can use fmap in order to confuse people instead of ., though... 2009-06-25.txt:16:38:41: <ehird> pikhq: it is the opinion of many that map and (.) should not exist, and that fmap should be called (.) 2009-06-26.txt:01:09:10: <oerjan> !haskell import System.Random; main = sequence_ . replicate 200 $ fmap (putStr . (["hurf","durf","hurd"]!!)) randomRIO (0,2) 2009-06-26.txt:05:24:26: <pikhq> > fmap ord ['\0'..] 2009-06-26.txt:05:27:58: <pikhq> > fmap chr $ (+) <$> (fmap ord ['\0'..]) <*> cycle [1] 2009-06-26.txt:05:30:49: <pikhq> > fromZipList $ fmap chr $ (+) <$> (fmap ord ['\0'..]) <*> cycle [1] 2009-06-26.txt:05:31:16: <pikhq> > getZipList $ zipList (fmap chr $ (+) <$> (fmap ord ['\0'..])) <*> zipList $ cycle [1] 2009-06-26.txt:05:31:35: <pikhq> > getZipList $ ZipList (fmap chr $ (+) <$> (fmap ord ['\0'..])) <*> ZipList $ cycle [1] 2009-06-26.txt:05:32:21: <immibis> @help fmap 2009-06-26.txt:05:32:31: <pikhq> > fmap chr $ fmap (+1) $ fmap ord ['\0'..] 2009-06-26.txt:05:33:19: <pikhq> > fmap . fmap . fmap chr (+1) ord ['\0'..] 2009-06-26.txt:05:33:54: <gracenotes> *FMAP* *FMAP* *FMAP* *FMAP* *FMAP* *FMAP* 2009-06-27.txt:02:16:43: <oerjan> however, m >>= return . f == fmap f m 2009-06-27.txt:02:18:02: <oerjan> no, fmap 2009-06-27.txt:02:18:07: <lambdabot> f <$> a = fmap f a 2009-06-27.txt:02:48:24: <oerjan> = fmap ((*198.838782).(*1079252848.8)) [1..] 2009-07-09.txt:20:00:36: <lambdabot> Data.Traversable fmapDefault :: Traversable t => (a -> b) -> t a -> t b 2009-07-09.txt:20:00:36: <lambdabot> Prelude fmap :: Functor f => (a -> b) -> f a -> f b 2009-07-12.txt:00:15:15: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:15:53: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:16:03: <Gracenotes> ..however it takes some time to infer longer fmap chains 2009-07-12.txt:00:16:14: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:17:33: <Gracenotes> oddly enough, it seems that any chain of fmaps always produces djinn functions in the original order 2009-07-12.txt:00:17:54: <ehird> :t t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:18:07: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:18:13: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:18:18: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:19:16: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:19:40: <ehird> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap 2009-07-12.txt:00:19:41: <pikhq> I'm renaming fmap. 2009-07-12.txt:00:20:38: <ehird> :t let (.) = fmap in (.) . . (.) 2009-07-12.txt:00:20:43: <ehird> :t let (.) = fmap in (.) . (. (.)) 2009-07-12.txt:00:21:05: <ehird> :t let (.) = fmap in (.) . (. (.)) . (((.) . ((.) . (.)) .) . ((.) .) . (.) 2009-07-12.txt:00:21:29: <Gracenotes> me no likey (.) = fmap 2009-07-12.txt:00:21:31: <ehird> :t let (.) = fmap in (.) . ((.)) . ( ((.) . ((.) . (.)) .) . ((.) .)) . (.) 2009-07-12.txt:00:21:39: <ehird> Gracenotes: but (.) and map are useless; they're just fmap 2009-07-12.txt:00:21:47: <pikhq> @src (->) fmap 2009-07-12.txt:00:21:48: <lambdabot> fmap = (.) 2009-07-12.txt:00:21:54: <ehird> @src [] fmap 2009-07-12.txt:00:21:54: <lambdabot> fmap = map 2009-07-12.txt:00:22:22: <ehird> @unpl let (.) = fmap in (.) . ((.)) . (((.) . ((.) . (.)) .) . ((.) .)) . (.) 2009-07-12.txt:00:22:22: <lambdabot> let { (.) = fmap} in (\ z b c f h i l o s -> z (b c f (h i l o s))) 2009-07-12.txt:00:22:29: <ehird> @unlet let (.) = fmap in (.) . ((.)) . (((.) . ((.) . (.)) .) . ((.) .)) . (.) 2009-07-12.txt:00:24:00: <pikhq> It's like fmap on the monads! 2009-07-12.txt:01:01:29: <lambdabot> fmap 2009-07-12.txt:01:09:45: <pikhq> :t ap `fmap` ($) 2009-07-12.txt:20:33:28: <ehird> pikhq: Cale used to have lambdabot lie about stuff. It had (.) = fmap 2009-07-12.txt:20:34:05: <pikhq> fmap should definitely be called fmap. 2009-07-12.txt:20:34:28: <pikhq> It's just a special case of fmap. 2009-07-15.txt:13:25:56: <ehird> > let (.) = fmap in head . words "aalso evel" 2009-07-16.txt:16:18:31: <lambdabot> Data.Traversable fmapDefault :: Traversable t => (a -> b) -> t a -> t b 2009-07-16.txt:16:18:31: <lambdabot> Prelude fmap :: Functor f => (a -> b) -> f a -> f b 2009-07-16.txt:16:18:33: <ehird> oh it's fmap 2009-07-16.txt:18:51:13: <pikhq> @. hoogle t fmap 2009-07-16.txt:18:51:38: <pikhq> @. hoogle type fmap 2009-08-15.txt:00:55:24: <pikhq> Now if you had asked about the difference between fmap and functional composition, I could say something. 2009-08-15.txt:00:55:32: <pikhq> Like, say, fmap being a generalisation. 2009-08-17.txt:04:52:36: <ehird> getArgs >>= mapM readFle >>= fmap (map parse) 2009-08-17.txt:04:53:32: <ehird> though (do args <- getArgs; contents <- mapM readFile args; parses <- fmap (map parse)) works too, but is tedious 2009-08-17.txt:04:54:05: <pikhq> Bah. fmap (map parse) <<= mapM readFile <<= getArgs 2009-10-03.txt:21:54:47: <pikhq> (/fmap/map/liftM2...) 2009-12-26.txt:13:13:52: <augur> xs >>= (return . f) == fmap f xs 2009-12-26.txt:13:17:48: <AnMaster> augur, what is fmap? 2009-12-26.txt:13:18:20: <soupdragon> you can define fmap usint >>= and return 2009-12-26.txt:13:18:45: <augur> fmap is i think probably somethat you can think of as like 2009-12-26.txt:13:20:06: <augur> and so in order to be a Monad you also have to be a Functor which means you have to have fmap defined. 2009-12-26.txt:13:20:58: <augur> fmap id x = x 2009-12-26.txt:13:21:19: <augur> fmap (f . g) x = fmap f (fmap g x) 2009-12-26.txt:13:22:36: <AnMaster> fmap takes a lambda and whatever it is to map over? 2009-12-26.txt:13:22:59: <soupdragon> fmap f m = do x <- m ; return (f x) 2010-01-05.txt:16:19:41: <oerjan> it's the same as fmap or <$> 2010-01-07.txt:01:01:49: <Asztal> (>>=) is SelectMany(), fmap is Select(), return is different for each one. 2010-01-09.txt:16:00:59: <ehird> I wish this were Caleskell and (.) = fmap 2010-01-09.txt:16:01:07: <ehird> Hey, maybe I could just define (.) = fmap 2010-01-09.txt:16:01:10: <Deewiant> You can set (.) = fmap easily 2010-01-09.txt:16:03:03: <pikhq> Deewiant: Caleskell makes (.)=fmap. 2010-01-09.txt:16:55:46: <ehird> fmap f (Strict a) = strictorlazy (f $! a) 2010-01-09.txt:16:55:46: <ehird> fmap f (Lazy a) = lazy (f a) 2010-01-09.txt:17:04:12: <ehird> fmap f x = pure f <*> x 2010-01-15.txt:17:47:58: <ehird> main = putStr =<< (fmap concat $ getArgs >>= mapM readFile) 2010-01-15.txt:17:53:13: <ehird> main = putStr =<< (fmap (reverse . concat) $ getArgs >>= mapM readFile) 2010-02-06.txt:14:25:07: <ehird> anyway, {| 2 + {3 ÷ x} |} is nicer to write than fmap (2 +) (3 ÷ x) 2010-02-06.txt:14:38:27: <ehird> which is even generaler than o = fmap, i think 2010-02-06.txt:14:38:48: <MissPiggy> fmap and o are quite different thuogh 2010-02-06.txt:14:39:02: <MissPiggy> fmap should just be map 2010-02-06.txt:14:39:14: <ehird> ok, that doesn't allow . = fmap 2010-02-13.txt:18:06:09: <alise> Functor f a = <fmap : (a -> b) -> f a -> f b> 2010-02-13.txt:18:07:19: <alise> Functor_List a = <fmap f x = map f x> 2010-03-07.txt:22:45:57: <alise_> Presumably along the lines of the elimination given by fmap above. 2010-04-02.txt:21:46:27: <pikhq> Functors are objects where fmap makes sense. 2010-04-02.txt:23:13:47: <oerjan> Quadrescence: as of now you only need to implement (>>=) and return to make a Monad. and haskell doesn't currently have a feature that allows you to deduce a _superclass_ method (Functor's fmap) from that, that's what this class something feature would do 2010-04-05.txt:04:42:35: <oerjan> const () `fmap` 2010-05-02.txt:23:38:38: <alise__> *Main> fmap biFro [0..10] 2010-05-02.txt:23:42:30: <alise__> *Main> fmap decrush [0..20] 2010-05-08.txt:23:15:03: <alise_> No, a monad is fmap, join and unit! 2010-06-20.txt:01:29:39: <CakeProphet> I wonder why they didn't just make map and fmap the same function. 2010-06-20.txt:01:36:24: <CakeProphet> I was wondering because the semantics of fmap only applies f to Right values 2010-06-27.txt:03:32:32: <CakeProphet> ah. fmap? 2010-07-12.txt:23:41:47: <aliseiphone> !haskell :t fmap fmap fmap 2010-07-12.txt:23:41:48: <EgoBot> fmap fmap fmap :: (Functor ((->) (a -> b)), Functor f1, Functor f) => 2010-07-20.txt:21:32:22: <pikhq> AnMaster: It's infix fmap. 2010-07-27.txt:03:26:04: <Mathnerd314> oerjan: x `subset` y = and (fmap (`elem` y) x 2010-08-06.txt:17:52:09: <alise> *Main> fmap fromRational (approxE 10000) 2010-08-09.txt:17:31:31: <alise> fmap id = id 2010-08-09.txt:17:31:34: <alise> fmap (f.g) = fmap f . fmap g 2010-08-10.txt:22:51:37: <oerjan> Phantom_Hoover: x >>= return . f = fmap f x (or liftM f x) 2010-08-10.txt:22:54:18: <Phantom_Hoover> oerjan, hang on, fmap can work without bind, obviously. 2010-11-02.txt:11:19:21: <elliott> unify (H (Conj xs)) (S (Conj ys)) = fmap concat . sequence $ zipWith unify xs ys 2010-11-02.txt:11:37:31: <elliott> case catMaybes $ map (\(l,r) -> fmap ((,) r) (unify l x)) ys of 2010-11-02.txt:11:39:05: <elliott> unify (H (Conj xs)) (S (Conj ys)) = fmap concat . sequence $ zipWith unify xs ys 2010-11-02.txt:11:45:24: <elliott> case mapMaybe (\(l,r) -> fmap ((,) r) (unify l x)) ys of 2010-11-30.txt:16:27:04: <elliott> map (\(Rule lhs rhs) -> (rhs,) `fmap` sab lhs t) $ rs 2010-11-30.txt:17:08:49: <elliott> case catMaybes . map (\(Rule lhs rhs) -> (rhs,) `fmap` sab lhs t) $ rs of 2010-12-11.txt:21:58:04: <elliott> join . fmap return == id 2010-12-11.txt:21:58:04: <elliott> join . join == join . fmap join 2010-12-11.txt:21:58:20: <elliott> oerjan: wait do you need fmap to do a monad? doesn't join/return suffice 2010-12-11.txt:22:00:32: <Phantom_Hoover> (>>= f) = join (fmap f), yes? 2010-12-11.txt:22:18:00: <elliott> hm so wait how do you do bind in terms of fmap and join? 2010-12-11.txt:22:18:10: <elliott> x >>= f = join (fmap f x) 2010-12-11.txt:22:23:26: <Phantom_Hoover> Indeed, (>>=) = flip $ join . fmap 2010-12-11.txt:22:25:45: <oerjan> (>>=) = flip $ (join .) . fmap 2010-12-11.txt:22:27:03: <Phantom_Hoover> bind = (join .) . flip fmap 2010-12-11.txt:22:30:26: <Phantom_Hoover> elliott, how's fmap defined for Tree? 2010-12-11.txt:22:48:04: <Phantom_Hoover> elliott, fmap (A B : Set) (f : A -> B). 2010-12-11.txt:22:48:35: <Phantom_Hoover> fmap [elided or not actually there depending on what's set] id is a type error. 2010-12-11.txt:22:49:03: <elliott> Phantom_Hoover: OK, please give me the full definition of fmap. 2010-12-11.txt:22:49:13: <elliott> Phantom_Hoover: OK, please give me the full definition of fmap. 2010-12-11.txt:22:49:36: <elliott> Phantom_Hoover: OK, please give me the full definition of fmap. 2010-12-11.txt:22:50:00: <Phantom_Hoover> Fixpoint fmap (A B : Set) (f : A -> B) (t : tree A) : tree B := [elided]. 2010-12-11.txt:22:51:57: <Phantom_Hoover> Essentially, I'm told that fmap id is an error as id : ID rather than * -> *. 2010-12-11.txt:22:52:26: <elliott> Phantom_Hoover: You might want to try using {A B : Set} in fmap. 2010-12-11.txt:22:53:40: <elliott> Coq < Axiom fmap : forall (A B : Set) (f : A -> B) (t : tree A), tree B. 2010-12-11.txt:22:53:40: <elliott> fmap is assumed 2010-12-11.txt:22:53:48: <elliott> fmap_id 2010-12-11.txt:22:55:33: <elliott> Coq < Definition fmap_id (A : Set) (t : tree A) : tree A := fmap A A (id (A:=A)) t. 2010-12-11.txt:22:55:33: <elliott> fmap_id is defined 2010-12-11.txt:22:58:34: <elliott> Phantom_Hoover: When you say "fmap A A id t", it can't infer what the value of A is in id's type, (forall A, A -> A). 2010-12-16.txt:16:54:35: <Phantom_Hoover> ais523, erm... Functor and fmap? 2010-12-16.txt:16:55:02: <ais523> in fact, liftM and fmap are IIRC the same function 2010-12-18.txt:22:50:11: <Phantom_Hoover> Anything's a monad if you can get return, join and fmap working on it! 2010-12-18.txt:22:51:04: <elliott> fmap seems obvious. 2010-12-18.txt:22:53:32: <Deewiant> Phantom_Hoover: join . fmap join = join . join 2010-12-18.txt:22:54:16: <Deewiant> = join . fmap return 2010-12-29.txt:19:43:14: <Phantom_Hoover_> Surely fmap f = (pure f <*>) 2010-12-29.txt:19:53:50: <Phantom_Hoover_> Where fmap f = (pure f <*>) 2011-01-09.txt:05:46:51: <oerjan> elliott: well it's fmap/liftM + <=< of course 2011-01-09.txt:05:48:00: <oerjan> :t (\f x -> fmap f . x) 2011-01-09.txt:05:49:20: <oerjan> lambdabot still defines (.) = fmap :D 2011-01-09.txt:05:49:47: <elliott> oerjan: but yes, of course it defines (.) = fmap, as specified by the Caleskell Report 2011-01-09.txt:05:50:26: <elliott> fmap fmap fmap 2011-01-09.txt:05:51:43: <oerjan> indeed it _is_ fmap fmap fmap 2011-01-09.txt:05:52:03: <elliott> fmap fmap fmap fmap fmap fmap fmap 2011-01-09.txt:05:52:26: <oerjan> elliott: that reiterates after four fmaps 2011-01-14.txt:18:01:51: <lambdabot> ([(c1', s1), (c2', s2)] ++) `fmap` apply c xs 2011-01-14.txt:18:16:10: <oerjan> 19:04 lambdabot> ([(c1', s1), (c2', s2)] ++) `fmap` apply c xs 2011-01-22.txt:15:25:44: <oerjan> in which case, mdo iorefs <- (: iorefs) `fmap` newIORef whatever should work, i don't think you even need unsafeInterleaveIO for that 2011-01-23.txt:20:01:41: <lambdabot> NB: In lambdabot, (.) = fmap 2011-01-23.txt:20:03:28: <elliott> olsner: imo map needs to become fmap 2011-01-29.txt:03:37:37: <oerjan> :t \f x -> fmap ($ x) f 2011-01-29.txt:03:38:03: <elliott> @pl \f x -> fmap ($x) f 2011-01-29.txt:03:38:03: <lambdabot> flip (fmap . flip id) 2011-01-29.txt:03:38:16: <elliott> let flip = flip (fmap . flip id) 2011-01-29.txt:03:52:56: <oerjan> :t \f x -> fmap ($x) f 2011-01-29.txt:03:55:23: <oerjan> :t (\f x -> Data.Traversable.traverse f x) `asTypeOf` (\f x -> fmap ($x) f) 2011-01-29.txt:03:58:11: <oerjan> :t (\f x -> Data.Traversable.sequenceA f x) `asTypeOf` (\f x -> fmap ($x) f) 2011-01-31.txt:02:26:15: <lambdabot> Prelude fmap :: Functor f => (a -> b) -> f a -> f b 2011-01-31.txt:02:32:30: <elliott> fmap fmap fmap 2011-01-31.txt:02:35:11: <oerjan> :t let map f (Left x) = fmap f x; map f (Right b) = Nothing in map 2011-01-31.txt:02:35:51: <oerjan> :t let map f (Left x) = Just $ fmap f x; map f (Right b) = Nothing in map 2011-01-31.txt:02:36:47: <oerjan> :t let map f (Left x) = Just $ fmap f x; map f (Right False) = Nothing; map f (Right True) = [] in map 2011-01-31.txt:02:36:55: <oerjan> :t let map f (Left x) = Just $ fmap f x; map f (Right False) = Nothing; map f (Right True) = Just [] in map 2011-02-03.txt:23:03:52: <lambdabot> Prelude fmap :: Functor f => (a -> b) -> f a -> f b 2011-02-03.txt:23:03:52: <lambdabot> Control.Monad fmap :: Functor f => (a -> b) -> f a -> f b 2011-02-03.txt:23:04:04: <elliott> @pl flip fmap 2011-02-03.txt:23:04:04: <lambdabot> flip fmap 2011-02-03.txt:23:09:18: <lambdabot> (`fmap` pUL) . (:<) =<< pSimpleUL 2011-02-07.txt:00:40:10: <Deewiant> Use fmap and ap and @unpl 2011-02-07.txt:01:16:26: <lambdabot> Data.Traversable fmapDefault :: Traversable t => (a -> b) -> t a -> t b 2011-02-07.txt:01:16:26: <lambdabot> Prelude fmap :: Functor f => (a -> b) -> f a -> f b 2011-02-07.txt:12:20:21: <lambdabot> (popVec >>=) . (return .) =<< fmap (flip poke) pop 2011-02-08.txt:11:41:32: <oerjan> > let (<$) = fmap . const; infixl 1 <$ in do x <- y <$ Just z ; return x 2011-02-08.txt:11:41:44: <oerjan> > let (<$) = fmap . const; infixl 1 <$ in do x < - y <$ Just z ; return x 2011-02-08.txt:18:13:26: <copumpkin> elliott: I dunno, which do you typically want to fmap? 2011-02-09.txt:19:12:46: <elliott> :t fmap 2011-02-17.txt:19:50:32: <elliott> oerjan: `fmap` instead of <$>? srsly? 2011-02-17.txt:19:57:28: <oerjan> <elliott> oerjan: `fmap` instead of <$>? srsly? <-- if i start using <$>, i'll soon want Applicative notation, and HP's Parsec doesn't have an instance, and basically i don't even want to bother to try because it makes me annoyed 2011-03-11.txt:17:35:39: <oerjan> flip and fmap, are there any others like that... 2011-04-13.txt:22:57:26: <newsham> oerjan: you could use `fmap` and `ap` instead of <$> and <*> if you wanted to stay in monad 2011-04-13.txt:22:57:57: <oerjan> also you mean liftM not fmap 2011-04-13.txt:22:58:16: <newsham> ?type (liftM, fmap) 2011-05-12.txt:16:10:36: <ais523> I know I tend to define fmap for my own structures if it fits 2011-05-12.txt:16:14:24: <ais523> fmapM :: Monad m => (a -> m b) -> (t a) -> m (t b) 2011-05-12.txt:16:14:35: <ais523> I think I needed to cross fmap and mapM 2011-05-14.txt:10:18:01: <oerjan> synonym for fmap 2011-05-14.txt:10:18:03: <CakeProphet> fmap. applies a function to a Functor instance. All monads are functors. 2011-05-14.txt:10:20:45: <oerjan> it's the monad equivalent of fmap, existing for stupid "missing subclassing" reasons 2011-06-06.txt:22:47:03: <CakeProphet> ah so <$ is fmap.const 2011-06-06.txt:22:47:20: <elliott> :t fmap.const 2011-06-06.txt:22:48:27: <elliott> because I think we could deduce that (fmap . const) and (<$) are the same by just the types 2011-06-06.txt:22:48:35: <lambdabot> fmap :: (a -> b) -> f a -> f b 2011-06-06.txt:22:49:00: <oerjan> and i think it applies to fmap.const = (<$) 2011-06-06.txt:22:49:25: <elliott> \a b -> fmap _ b 2011-06-06.txt:23:04:50: <elliott> > fmap (take 9) (some (Just 9)) 2011-06-06.txt:23:21:33: <elliott> fmap f (ZipList xs) = ZipList (map f xs) 2011-06-13.txt:00:52:51: <elliott_> oh its actually cofmap :: (a -> b) -> acc b -> acc a :P 2011-06-13.txt:00:54:19: <elliott_> > fmap succ (9,9) 2011-06-13.txt:01:04:35: <elliott_> cofmap :: (a -> b) -> cof b -> cof a 2011-06-13.txt:01:04:39: <elliott_> cofmap f (Flip g) = Flip (g . f) 2011-06-15.txt:00:59:32: <monqy> not fmap? 2011-06-15.txt:00:59:52: <monqy> (I was expecting it to be a synonym of fmap) 2011-06-15.txt:00:59:55: <oerjan> i _thought_ they'd also made map a synonym for fmap, but i must have misremembered 2011-06-15.txt:01:40:59: <oerjan> it's rather stupid to have map, fmap, <$>, liftM 2011-06-15.txt:01:41:43: <lambdabot> f <$> a = fmap f a 2011-06-15.txt:01:41:54: <Patashu> so it's just infix fmap 2011-06-15.txt:01:41:58: <Patashu> why not just use `fmap` then 2011-06-15.txt:01:42:07: <oerjan> Patashu: it can work on functors too, in fact it did before Haskell 98 revision, when fmap = map 2011-06-15.txt:01:42:55: <oerjan> it separated map from fmap, making map work just for lists. 2011-06-15.txt:01:45:07: <monqy> just use fmap 2011-06-15.txt:01:47:56: <monqy> e.g. for a Functor instance of a Monad, fmap f = (>>= return . f) 2011-06-15.txt:01:48:27: <lambdabot> fmap :: (a -> b) -> f a -> f b 2011-06-15.txt:01:49:59: <Patashu> (+) <$> [1,2] <*> [10,20] becomes <*> ( fmap (+) [1,2] ) ( [10,20] ) 2011-06-15.txt:01:50:54: <Patashu> > (<*>) ( fmap (+) [1,2] ) ( [10,20] ) 2011-06-21.txt:11:45:59: <elliott> :t ?f.?g `fmap` x 2011-06-21.txt:11:46:02: <elliott> :t ?f.?g `fmap` ?x 2011-06-21.txt:11:46:04: <elliott> :t ?f . ?g `fmap` ?x 2011-06-21.txt:11:46:05: <lambdabot> cannot mix `.' [infixr 9] and `fmap' [infixl 9] in the same infix expression 2011-06-21.txt:12:04:15: <elliott> <elliott> ?pl \f x -> join (fmap f x) 2011-06-21.txt:18:53:39: <elliott_> ?pl (\(r,n) -> ifuckinghateyouass r) `fmap` I.zip it countWords 2011-06-21.txt:18:53:40: <lambdabot> (ifuckinghateyouass . fst) `fmap` I.zip it countWords 2011-06-21.txt:18:53:47: <elliott_> ?pl flip fmap 2011-06-21.txt:18:53:47: <lambdabot> flip fmap 2011-06-21.txt:18:54:33: <lambdabot> Prelude fmap :: Functor f => (a -> b) -> f a -> f b 2011-06-21.txt:18:54:33: <lambdabot> Control.Monad fmap :: Functor f => (a -> b) -> f a -> f b 2011-06-21.txt:19:07:04: <elliott_> where opt field ctr = \it -> uncurry (setL field . Just) `fmap` I.zip it ctr 2011-06-21.txt:19:32:27: <elliott_> option field ctr = \it -> uncurry (setL field . Just) `fmap` I.zip ctr it 2011-06-21.txt:19:39:53: <oerjan> elliott_: perhaps that fmap is also building thunks of what to apply 2011-06-23.txt:19:22:47: <elliott_> > foldlM (\r x -> if even x then (9:) `fmap` r else Nothing) [] [0,0,9] 2011-06-25.txt:01:03:21: <monqy> :t fmap id 2011-07-01.txt:10:21:49: <Deewiant> ?src Either fmap 2011-07-01.txt:10:21:49: <lambdabot> fmap _ (Left x) = Left x 2011-07-01.txt:10:21:50: <lambdabot> fmap f (Right y) = Right (f y) 2011-07-03.txt:02:53:37: <elliott> fmap = liftM 2011-07-03.txt:06:59:08: <elliott> fmap f (T ph pf pr) = T ( \ k -> ph ( k .f )) 2011-07-03.txt:07:22:14: <elliott> you can't do that fmap 2011-07-03.txt:07:26:33: <elliott> so basically I have fmap... for lenses :) 2011-07-03.txt:07:27:05: <elliott> yep, what I have is (.), aka generalised fmap :D 2011-07-03.txt:07:48:51: <elliott> fmap concat (sequence (concatMap (\(n,_,_) -> [ [d| foo = 9 |] ]) oks)) 2011-07-03.txt:08:16:00: <elliott> mapM (\(n,_,_) -> funD (transform n) [clause [] (normalB ([|Data.Lens.Lens|] `appE` varE n `appE` lamE [varP _f, varP _x] (recUpdE (varE _x) [(\x->(n,x)) `fmap` [|$(varE _f) ($(varE n) $(varE _x))|]]))) []]) oks 2011-07-03.txt:08:35:31: <elliott> mapM (\(n,_,_) -> funD (transform n) [clause [] (normalB ([|Data.Lens.Lens|] `appE` varE n `appE` lamE [varP _f, (asP _x (recP nn [return (n,VarP _y)]))] (recUpdE (varE _x) [(\x->(n,x)) `fmap` [|$(varE _f) $(varE _y)|]]))) []]) oks 2011-07-03.txt:11:04:01: <olsner> CakeProphet: you can think of it as fmap (fmap (flip fmap fmap) fmap) fmap, if composition is confusing :) 2011-07-03.txt:11:13:35: <olsner> also, (.).(.) = the boobies combinator = fmap fmap fmap 2011-07-03.txt:11:16:18: <CakeProphet> but... fmap = (.) for functions right? 2011-07-03.txt:11:17:41: <olsner> yes, one functor instance has fmap = (.), and to make matters better lambdabot has (.) defined as fmap 2011-07-03.txt:11:24:14: <Phantom_Hoover> <olsner> yes, one functor instance has fmap = (.), and to make matters better lambdabot has (.) defined as fmap 2011-07-03.txt:11:33:41: <CakeProphet> :t fmap 2011-07-05.txt:00:39:22: <elliott> :t liftM2 (:) (return ?x) (return `fmap` copy ?y) 2011-07-05.txt:00:39:24: <elliott> :t liftM2 (:) (return ?x) (return `fmap` ?copy ?y) 2011-07-05.txt:00:39:32: <elliott> :t \x y -> liftM2 (:) (return x) (return `fmap` ?copy y) 2011-07-05.txt:00:39:43: <elliott> ?pl liftM2 (:) (return x) (return `fmap` ?copy y) 2011-07-05.txt:00:39:48: <elliott> ?pl \x y -> liftM2 (:) (return x) (return `fmap` copy y) [too many lines; stopping]