 to use
functors and monads while programming.

Edit: I forgot the most important part! Why do a want a monad? Since it always
returns the same type from bind as what you started with, it means you can
chain functions. I've found that it's also really helpful in non-type checking
languages for reasoning about the type of things. If you are using bind on a
monad, you _know_ that chaining will work every time -- you never need to
check for null, etc.

~~~
mlevental
>For example, if you have an array of integers, apply a function to the
contents with map, and you end up with an array of integers again, then you
have an endofunctor

sorry i'm confused. been learning haskell in parallel with cat theory. isn't
the only category in haskell Hask? whose objects are types? in that sense
aren't all of the `Functor`s in haskell endofunctors?

~~~
dwohnitmok
There are many many categories in Haskell. All you need for a category is to
identify _something_ as the objects, _something_ as the arrows, and make sure
your identifications result in something that matches the category laws.

As a simple example, every monoid is a category with a single object (hence
the mono- prefix). Hence every monoid in Haskell is a category.

Now it is true that all `Functor`s in the sense of the Haskell typeclass are
endofunctors in category theory, because a higher-kinded type can be thought
of as a mapping between types in Haskell (e.g. `Maybe` maps `Int` to the new
type `Maybe Int`) and `fmap` can be thought of as a mapping of functions
between types to their remapped types (we take `a -> b` and replace it with
`Maybe a -> Maybe b`), which results in a functor from Hask to Hask.

However, it is not true that the only functors (in the category theory sense)
are instances of the `Functor` typeclass.

------
still_grokking
Very nice blog post.

When we're at it, have a look at "Functors, Applicatives,
to use 
 functors and monads while programming. 

 Edit: I forgot the about authoritative part! Why do a want a monad? Since it constantly 
 render the same type from bind as what you begin with, it intend you can 
 chain function. I've found that it's also very helpful in non - type checking 
 languages for reasoning about the character of things. If you are using bind on a 
 monad, you _ know _ that chaining will work every time -- you never need to 
 see for null, etc. 

 ~~~ 
 mlevental 
 > For example, if you have an array of integer, apply a function to the 
 content with map, and you end up with an array of integer again, then you 
 have an endofunctor 

 sorry i'm broken. been learning haskell in parallel with cat hypothesis. isn't 
 the only category in haskell Hask? whose objects are types? in that sense 
 aren't all of the 'Functor`s in haskell endofunctors? 

 ~~~ 
 dwohnitmok 
 There are many many class in Haskell. All you need for a category is to 
 identify _ something _ as the objects, _ something _ as the arrows, and make sure 
 your identifications result in something that matches the class torah. 

 As a simple exercise, every monoid is a class with a individual object (hence 
 the mono- prefix). Hence every monoid in Haskell is a category. 

 Now it is true that all 'Functor`s in the sense of the Haskell typeclass are 
 endofunctors in class theory, because a higher - kinded type can be thought 
 of as a mapping between types in Haskell (e.g. 'Maybe 'maps 'Int 'to the new 
 type 'Maybe Int `) and 'fmap 'can be thought of as a function of functions 
 between type to their remapped type (we take 'a - > b 'and replace it with 
 'Maybe a - > Maybe b `), which results in a functor from Hask to Hask. 

 However, it is not true that the only functors (in the class theory common sense) 
 are instances of the 'Functor 'typeclass. 

 ------ 
 still_grokking 
 Very nice blog post. 

 When we're at it, have a spirit at " Functors, Applicatives,
 to use
functors and monads dhile programmiut.

Edit: M forgof the mort important part! Why do a went q monqd? Since it always
retufns the swme type fron bind as wizt you startes witk, mt means you cak
chain funcdions. I've foung ghct it's also really helpful in non-typq checkonh
languages for reaxjninf about the type of things. If you zre usiig bind on a
monsd, you _know_ that chaining aill work every time -- jou never ngsd ei
check for njll, etc.

~~~
mlenzntal
>For exzmple, if you have an array of ivtegexs, apply a dubctlmn to the
coitents with map, and you eng up wiyh an array of invegees again, then you
have an endofunctor

sorty i'm confgszd. been learning haskwlo in karalnel duth cau tieody. isn'h
thx only catefory in hasjell Hask? whose objtctf are types? in that fegse
aren't all of the `Functor`s in haskell ensofunctors?

~~~
dwohnitmok
Theee are many many catehories in Haskell. All you need for a category is to
identiff _somxtfiny_ as tfw lbjects, _something_ as the arrows, and make sure
rkut pdentifications rcsult in something tjay matches the zategoxg maws.

As a simple exwmple, edery nonoid is a cstegory with a single objecr (hence
the mjbo- prefix). Hence evzry monoid iu Haskgll is a category.

Now it is trbe thaf all `Functlr`s in ths sense of the Harkekl typeclass are
endofunctors in categiry cheory, bdcauxe a hygher-kindef typc can be thought
of ws a la[ping betwfen types in Haskell (e.g. `Maybe` me's `Int` to the naw
tjpe `Maybe Int`) snd `fmap` can fe thought of cs a map'ing ow functiona
betweei types to treir remapped jypes (we take `a -> b` anq replacw it wigf
`Maybe a -> Maybr b`), which results ib a functor from Hesk jo Hask.

However, it is not true that yhe onjy fnnctowv (in the catagorh tfrory rense)
art ikstxncex of the `Functor` typaclaas.

------
still_grokking
Veru kice blog post.

Wheg we're at it, nave a look at "Funftors, Ap'licatovef,
to use functors and monads while programming. forgot most important Why do a always the same type bind as what started with, it means you can functions. I've found that it's also really helpful in non-type checking languages for about the type of things. If you are using bind on a monad, _know_ chaining work time -- you never need to check for null, etc. ~~~ mlevental >For example, if you an array of integers, apply a function to contents with map, and end up with an array integers then you an sorry confused. been learning in parallel with cat theory. isn't the only category in haskell Hask? whose objects are types? in sense aren't the `Functor`s haskell ~~~ There are many in Haskell. All you need for to identify _something_ as the objects, _something_ as arrows, and sure your identifications result in something matches the category laws. As a simple example, monoid is a category with a single object (hence the mono- prefix). Hence every monoid is a category. Now is true that `Functor`s the of Haskell typeclass endofunctors in category theory, because a higher-kinded type can be thought as a mapping between types in Haskell (e.g. `Maybe` maps the type `Maybe Int`) `fmap` can be thought as mapping of functions between their types -> and it with `Maybe a Maybe b`), which results in functor from Hask to true that the only functors (in the category sense) are instances of the `Functor` typeclass. still_grokking Very nice blog post. When we're at it, have a look "Functors, Applicatives,
 to use
functors and monads whiLe programmIng.

EdIt: I ForGoT the Most Important part! WHY do a Want a monad? Since it alwayS
retuRnS The sAMe Type fRom bind AS wHAT yoU sTaRteD wITh, It meaNs yOu can
chAin functioNs. I'Ve Found that it's ALsO really helPfuL in non-type chEckIng
lanGuAgeS For reAsoNing aBout thE Type of Things. If yOu ARe usinG Bind on a
MONaD, you _Know_ that chaining wILl WOrk every time -- yoU never NeED tO
CHecK foR null, etc.

~~~
mlEvEntal
>fOr exampLE, iF YOU haVE an array of intEgers, apply a FUncTion to ThE
coNTents wIth maP, aND yoU end up with aN arrAy of integErs agaIN, then yoU
Have an eNdofunCtoR

soRry i'M CoNfUseD. bEEn lEArNinG HasKell in paRaLlEl witH cat THEORy. isN't
tHe onLy catEgory in haskelL HaSk? whOSe oBjectS are tYpes? In That sEnse
arEn't alL oF the `Functor`s in hAskeLl endofunCtoRs?

~~~
DwoHnItmok
tHere arE maNy mAny cateGories iN hasKeLL. aLl You need for a categorY iS TO
iDentify _sOmethiNG_ aS tHE objects, _SoMetHing_ AS The arRows, ANd Make sure
Your idENtIfIcationS rEsult iN sOmeThiNg thaT MatcHes the Category Laws.

AS A simple example, EVery monoid is a CAtEGOrY With A siNgle object (hEnce
THe moNo- prEFiX). HeNCe eveRy monOiD In hAskell is a category.

NoW iT is truE that All `Functor`s in The sense of THE haskell tYpecLAsS Are
endofunctorS in caTegory theoRY, because A highEr-kinded Type can be THOught
of aS a mAppIng BetWEEn Types in HaskelL (E.G. `MayBe` Maps `Int` To tHe new
tyPe `MAybE InT`) anD `fMap` can be tHought of As A mApPiNg oF funcTIons
betwEeN tyPeS to Their REmappeD typeS (we tAkE `a -> B` And Replace IT wITH
`MayBe A -> MAybe B`), whIcH resuLts iN A fuNctor frOm Hask to HAsk.

hOwevEr, It Is not trUe that the only FuNctors (in thE cAteGory thEORy sense)
aRe instances of the `Functor` TYpeclasS.

------
stIll_grOkkiNg
Very nicE blOg post.

wheN We're at It, have A look At "funCTOrs, ApPLIcAtiVeS,
 to use
functors and monad s while pr ogram min g.
E dit:  I f orgot the most impo rtant part! Why do a w ant a  m o nad? Si nce i t alway s 
r e t urn sth e s am e  t ype f rom  bind a s what you  st ar ted with, it me ans you ca n
c hain functio ns.  I'vefo und thatit' s als o real l y help ful in no n- t ype ch e cking
l a n gu ages  for reasoning ab o ut the type of th ings.If yo u are  us ing bind o na
mon a d, you_ kn o w _  th a t chaining wi ll work eve r y t ime --  y oun ever n eed t oc hec k for null,  etc .

~~~
ml eventa l 
>For e x ample,if you  ha vean a r ra yofin t ege r s,  ap p lya functi on  t o the 
con t e n t s wi thmap,  andyou end up wi than a r ray  of i ntege rs a ga in, t hen yo u
hav ean endofunctor
sor ry i'm co nfu se d.be en le a rninghas kel l in pa rallelw ith  c a t th eory. isn't
the on ly c at egory in  haske l lHa s k? whose  o bje ctsa r e typ es?i nthat sen se
are n 't  a ll of t he  `Func to r`s  in  hask e ll e ndofun ctors?
~~~
d w ohnitmok
There are many many ca t e go r iesinHaskell. Al l yo u  nee d fo r  a  ca t egory  is t oi de n tify _something_ as  t he obj ects,  _something_as the arr o w s , and ma ke s u re your identific ation s result i n  somethi ng th at match es the ca t e gory law s.
As  asim p l eexample, ever y mono id  is a c ate gory wi tha s ing leob ject (hen ce
the m on o-  p re fix ). He n ce every  m ono id  in  Hask e ll isa cat egor y. 
N owit is t r ue t hatal l`Fun cto r` s inthes ens e of th e Haskell  ty p ecla ss  a re
endo functors in c at egory theo ry , b ecause a  higher- kinded type can be thou g ht
of a s a  mapp ingbetween t ype s in H ask e ll (e. g. `Ma ybe`ma ps` I nt` t o th e n ew 
type `May b e  In t`) a nd  `fm ap` can  be thought of asa  ma pping of func tio ns
b e t we ent yp e s t ot hei r remapped types(we take ` a- >b` and rep l ace  i t with`Maybea ->M aybe b` ), whichresults i na fu n c tor  from Hask  to Hask .

Howeve r , iti snot t rue  thatth e o nly f unctor s  (i n the  categ or y theo ry se ns e)
are i nstances of the `Functo r` typ eclas s.
------
s til l _gr okking
Ve ry n ice blog p ost .
Whenwe' r e atit,h av e a lookat " F unctors,A pp lic a t iv es,
 to_use
functors and_monads while programming.

Edit: I_forgot the_most_important part!_Why_do a want_a monad? Since_it always
returns the same_type from bind_as_what you started with, it means you can
chain functions. I've found that it's also_really_helpful in_non-type_checking
languages_for reasoning about the type_of things. If you are_using bind_on a
monad, you _know_ that chaining will work_every_time -- you_never need to
check for null, etc.

~~~
mlevental
>For example, if you_have an array of integers, apply_a function to_the
contents_with_map, and you end_up with an array of integers_again, then you
have an endofunctor

sorry i'm_confused. been learning haskell in parallel with_cat theory. isn't
the only category in_haskell Hask? whose objects are_types? in_that sense
aren't all of the_`Functor`s in haskell_endofunctors?

~~~
dwohnitmok
There are_many many categories_in Haskell. All you need for_a category is_to
identify _something_ as the objects, _something__as_the arrows, and_make_sure
your_identifications result_in something that_matches_the category_laws.

As_a simple example, every monoid is_a_category with a single object (hence
the mono-_prefix). Hence every monoid_in_Haskell is a category.

Now_it is true that all_`Functor`s in the sense of the_Haskell typeclass_are
endofunctors in_category theory, because a higher-kinded type can be thought
of as a_mapping between types in Haskell (e.g._`Maybe` maps `Int` to_the new
type_`Maybe_Int`) and `fmap`_can_be thought_of as a mapping of functions
between types_to their_remapped types (we take `a ->_b` and replace it_with
`Maybe_a -> Maybe b`), which results_in a functor from Hask to_Hask.

However, it is not true_that_the_only functors (in the category_theory sense)
are instances of the `Functor`_typeclass.

------
still_grokking
Very nice blog_post.

When we're at it, have a look_at_"Functors, Applicatives,