dibblego 2017-02-07 04:45:15
instance Functor [] where fmap f = foldr ((:) . f) [] implicit def ListFunctor: Functor[List] = new Functor[List] { def fmap[A, B](f: A => B) = _.foldRight(Nil)((a, b) => f(a) :: b) }
noan 2017-02-07 04:45:16
well, not a thingy, a mapping
sea_wulf 2017-02-07 04:45:45
My bad, I was conflating mappings between categories and mappings, themselves I think
dibblego 2017-02-07 04:45:48
"morphism" is a very general, and context-dependent term. It is Greek for transformation
sshine 2017-02-07 04:45:50
sea_wulf, in the category of small categories, functors can be thought of as morphisms. =)
Logio 2017-02-07 04:45:52
noan: between the images of the types, yes
dibblego 2017-02-07 04:45:56
what sea_wulf said :)
noan 2017-02-07 04:46:25
I meant it in the category sense.
sshine 2017-02-07 04:46:31
sea_wulf, yeah, morphisms are what's inside categories and functors are what's between categories.
noan 2017-02-07 04:46:38
Trying to learn me some basic category theory lately.
sea_wulf 2017-02-07 04:46:44
thanks sshine!
sshine 2017-02-07 04:46:46
sea_wulf, so when you have categories of categories they can be the same :P
dibblego 2017-02-07 04:46:58
noan: I am typing with 6 fingers, instead of 9, I have to stop, bye
noan 2017-02-07 04:47:19
wait... does this mean that an Endofunctor is a sort of identity mapping for a category?
Ford_Prefect 2017-02-07 04:47:50
Anyone know how I can make JSON output from Aeson+Servant pretty?
noan 2017-02-07 04:47:53
dibblego, perfectly understandable. Rest well. Type me a 1 if they're permanently lost and 2 if merely injured. I'll ask for an explanation at a later date.
sea_wulf 2017-02-07 04:48:04
Cool cool, I have been trying to work through https://arxiv.org/pdf/1612.09375v1.pdf lately so any bits of knowledge on category theroy help
sshine 2017-02-07 04:48:05
there can be other endofunctors than the identity functor.
sea_wulf 2017-02-07 04:48:13
*theory
Logio 2017-02-07 04:48:18
noan: not _the_ identity, but a morphism from the category to itself, yes
sshine 2017-02-07 04:48:38
yes, an endofunctor is a functor between a category and itself. that's what endo means .P
dibblego 2017-02-07 04:48:47
endo is greek for unto itself
noan 2017-02-07 04:49:16
sshine, but the identity morphism for a category is by definition an endofunctor I presume?
dibblego 2017-02-07 04:50:18
trait Endo[~>[_, _]] { def ontoitself[A]: A ~> A }
thatguy 2017-02-07 04:50:20
can someone maybe give me some hint how to achieve a thing like this: I have a Applicative Functor: Parser a which consumes some part of a string and returns a Maybe(a, String) with the rest of the string. I want to have a Parser [a] which runs parsers until one of them returns Nothing
dibblego 2017-02-07 04:50:23
gotta go 4 realz
noan 2017-02-07 04:50:29
id :: Foo a -> Foo a --must be an endofunctor right?
noan 2017-02-07 04:50:46
dibblego, just give me the 1 or 2, other people have brains to pick little dachshund. Rest well my friend.
noan 2017-02-07 04:50:58
I worry.
dibblego 2017-02-07 04:51:24
noan: it has been 9 fingers since 1996, it is 6 fingers until April, and hopefully 10 after that
sshine 2017-02-07 04:54:09
dibblego, you have a variable number of fingers?
dibblego 2017-02-07 04:55:01
I have had 9 [available for typing] since an accident in 1996, which was repaired today, leaving another 3 currently unservicable, with a long term goal of having all 10 typing
sshine 2017-02-07 04:55:11
noan, I'm not sure you'd call a morphism an endofunctor unless you're dealing with a category of categories...
noan 2017-02-07 04:55:59
dibblego, ah, I hope the recovery from surgery goes well.
dibblego 2017-02-07 04:57:31
I'd even type scala for you, with 6 fingers, never forget
halogenandtoast 2017-02-07 04:59:01
Is it possible to filter out attributes using taggy-lens? I know this is completely wrong, but something like `fmap (transform (children . attrs %~ filter (\n -> n ^? attr "class" != Just "class"))) a`
sshine 2017-02-07 04:59:13
noan, are you thinking of Yoneda's lemma?
sshine 2017-02-07 05:00:04
noan, I think you still need them to be small categories then.
halogenandtoast 2017-02-07 05:00:40
I don't understand lenses well so my code might not make any sense.
tabaqui1 2017-02-07 05:06:13
I have f :: Maybe (Int, Int)
tabaqui1 2017-02-07 05:06:33
and I want use alike pattern-matching in "where"
tabaqui1 2017-02-07 05:06:36
like so:
tabaqui1 2017-02-07 05:06:39
(a, b) = f
tabaqui1 2017-02-07 05:06:56
*(a, b) ~= f
tabaqui1 2017-02-07 05:07:03
a = b = Nothing if f returns Nothing
tabaqui1 2017-02-07 05:07:14
ah, ok, case syntax
tabaqui1 2017-02-07 05:07:16
nevermind
Sheo 2017-02-07 05:13:33
or, if i understood. a = fmap fst f; b = fmap snd f
ph88 2017-02-07 05:14:09
is there any way to figure out what is the next Arbitrary (quickcheck) thing being generated in the parent type? https://paste.fedoraproject.org/550625/86484004/
lyxia 2017-02-07 05:32:13
ph88: what does that mean
lyxia 2017-02-07 05:32:58
Oh, there's some comments I should read first.
thatguy 2017-02-07 05:35:02
if I have a parser for ints, and a parser for strings and a type Atom = I Int | S String, how can I make an Atom parser out of Parser Int <|> Parser String
lyxia 2017-02-07 05:35:45
thatguy: I <$> parseInt <|> S <$> parseString
thatguy 2017-02-07 05:36:16
lyxia: thanks :)
tabaqui1 2017-02-07 05:40:24
hmm, Data.Set has O(1) asymptotic for "size :: Set -> Int", while Data.HashSet and Data.IntSet have O(n)
lyxia 2017-02-07 05:40:44
ph88: the only options I can see are either to add the expected result of the lookahead as a parameter, or to return it in arbitraryT alongside T.
ertes 2017-02-07 05:41:43
tabaqui1: IntSet doesn't seem to store its size explicitly
ertes 2017-02-07 05:41:59
if you want it to be O(1), you need to keep track of it yourself
tabaqui1 2017-02-07 05:42:00
Sheo: about fmap . fst - there was little complicated tuple, and I wanted to extract (a, (_, c), _)
tabaqui1 2017-02-07 05:42:13
ertes: yes, why it doesn't store by desing
ertes 2017-02-07 05:42:28
tabaqui1: because it doesn't need it for its operations
jophish 2017-02-07 05:42:35
whois jw358
tabaqui1 2017-02-07 05:42:55
ertes: Data.Set don't use it too, right?
byorgey 2017-02-07 05:43:21
tabaqui1: perhaps because in order to compute the correct size it would have to force an entire insertion operation?
byorgey 2017-02-07 05:43:30
rather than letting some parts of it be computed lazily.
byorgey 2017-02-07 05:43:50
I am just guessing here, I don't actually know the details. You'd think if it was easy to keep track of the size the implementor would have done it.
ertes 2017-02-07 05:44:07
tabaqui1: Set needs the size for balancing
tabaqui1 2017-02-07 05:44:24
ertes: ok
ertes 2017-02-07 05:44:46
Set is a binary tree, while IntSet is a radix tree (or as djb would call it: a "critbit tree")