Logs: freenode/#haskell
| 2021-05-11 21:28:16 | → | jlv joins (jlvmatrixo@gateway/shell/matrix.org/x-sroisxuebnkuymhj) |
| 2021-05-11 21:28:17 | → | loyon joins (loyonmatri@gateway/shell/matrix.org/x-wfgvrkkcigndkuew) |
| 2021-05-11 21:28:17 | → | pqwy[m] joins (pqwymatrix@gateway/shell/matrix.org/x-nmncdudsgpkvcjbb) |
| 2021-05-11 21:28:17 | → | joe[m]4 joins (joemonoida@gateway/shell/matrix.org/x-ixdcppeznkmrpnze) |
| 2021-05-11 21:28:17 | → | jeffcasavant[m] joins (jeffcasava@gateway/shell/matrix.org/x-oykouxifvdgxkysk) |
| 2021-05-11 21:28:18 | → | Guillaum joins (guiboumatr@gateway/shell/matrix.org/x-kducmudiskihbpyx) |
| 2021-05-11 21:28:19 | → | adziahel[m] joins (adziahelma@gateway/shell/matrix.org/x-pfcbeahxuiuqhmxn) |
| 2021-05-11 21:28:19 | → | johnnyboy[m] joins (gifumatrix@gateway/shell/matrix.org/x-ygcqfwwgjhaithrv) |
| 2021-05-11 21:28:19 | → | toasty_avocado[m joins (toastyavoc@gateway/shell/matrix.org/x-fpzqttbvdljtkkux) |
| 2021-05-11 21:28:20 | → | CrabMan joins (phi-matrix@gateway/shell/matrix.org/x-affpxuluiytbahpu) |
| 2021-05-11 21:28:30 | <Uniaika> | :) |
| 2021-05-11 21:28:31 | → | sm[m] joins (simonmicma@gateway/shell/matrix.org/x-yjiisspildexrxnx) |
| 2021-05-11 21:28:35 | <Ernest> | Uniaika I understand that it's a valid way to declare instances over types, but how is a type of (a -> b) constructed and how do you use the fmap instance for it? |
| 2021-05-11 21:28:41 | → | theDon joins (~td@muedsl-82-207-238-126.citykom.de) |
| 2021-05-11 21:28:45 | <ski> | > sortBy (comparing length <> compare) (words "The quick brown fox jumps over the lazy dog") -- using `Semigroup a => Semigroup (rho -> a)' |
| 2021-05-11 21:28:46 | <Ernest> | fmap function* |
| 2021-05-11 21:28:47 | <lambdabot> | ["The","dog","fox","the","lazy","over","brown","jumps","quick"] |
| 2021-05-11 21:28:51 | <ski> | @where monoids |
| 2021-05-11 21:28:51 | <lambdabot> | comment on "Monoids? In my programming language?" by Cale in 2008 (or 2009 ?) at <http://www.reddit.com/r/programming/comments/7cf4r/monoids_in_my_programming_language/c06adnx> about a use of ` |
| 2021-05-11 21:28:51 | <lambdabot> | instance Monoid a => Monoid (rho -> a)' |
| 2021-05-11 21:29:21 | <ski> | Ernest : my example with `<$>' (which is an alias for `fmap') above shows one example of using it |
| 2021-05-11 21:29:50 | × | fendor quits (~fendor@178.165.129.215.wireless.dyn.drei.com) (Quit: Leaving) |
| 2021-05-11 21:29:54 | <Uniaika> | Ernest: (a -> b) is a function type |
| 2021-05-11 21:30:10 | <Uniaika> | you construct this type by having a function with the type a -> b |
| 2021-05-11 21:30:13 | <Uniaika> | input -> output |
| 2021-05-11 21:30:29 | → | Chai-T-Rex joins (~ChaiTRex@gateway/tor-sasl/chaitrex) |
| 2021-05-11 21:30:35 | × | Guest63188 quits (~alexander@2a02:587:dc0a:2700:39fb:67a3:1f47:16d) (Ping timeout: 260 seconds) |
| 2021-05-11 21:31:05 | <Uniaika> | Ernest: in the case of fmap :: (a -> b) -> f a -> f b |
| 2021-05-11 21:31:08 | → | fendor joins (~fendor@178.165.129.215.wireless.dyn.drei.com) |
| 2021-05-11 21:31:20 | <Uniaika> | it wants a function that operates on the value inside the functor |
| 2021-05-11 21:31:25 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 258 seconds) |
| 2021-05-11 21:31:29 | <Uniaika> | and you'll get a functor with the transformed value in it |
| 2021-05-11 21:31:57 | × | ChaiTRex quits (~ChaiTRex@gateway/tor-sasl/chaitrex) (Ping timeout: 240 seconds) |
| 2021-05-11 21:32:04 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-05-11 21:32:09 | → | justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311) |
| 2021-05-11 21:32:14 | <ski> | in case `f = (rho ->)', you get `fmap :: (a -> b) -> (rho -> a) -> (rho -> b)' (which is `(.)') |
| 2021-05-11 21:32:28 | <ski> | so, if `g' is a function, then `fmap f g' is the same as `f . g' |
| 2021-05-11 21:32:39 | → | tromp joins (~tromp@dhcp-077-249-230-040.chello.nl) |
| 2021-05-11 21:33:09 | <ski> | > (not . (> 3)) 10 |
| 2021-05-11 21:33:11 | <lambdabot> | False |
| 2021-05-11 21:33:14 | <ski> | > fmap not (> 3) 10 |
| 2021-05-11 21:33:16 | <lambdabot> | False |
| 2021-05-11 21:34:30 | <Ernest> | Ok this is now much clearer, thank you ski Uniaika monochrom Still need to chew on it a bit but the information is here |
| 2021-05-11 21:35:07 | <Uniaika> | Ernest: if you can get "Get Haskell Programming" by Will Kurt, I think it will unlock many unknowns |
| 2021-05-11 21:37:06 | <Ernest> | Hmm I'd say I'm able to program in haskell, but these small nitty gritty things I haven't ironed out yet, I'll have it as a reference thanks |
| 2021-05-11 21:37:30 | <ski> | @let instance Num a => Num (rho -> a) where (f + g) r = f r + g r; (f - g) r = f r - g r; (f * g) r = f r * g r; negate f r = negate (f r); abs f r = abs (f r); signum f r = signum (f r); fromInteger n r = fromInteger n |
| 2021-05-11 21:37:31 | <lambdabot> | Defined. |
| 2021-05-11 21:37:45 | <monochrom> | I'm a bit in disbelief when you act like you have never seen "X -> Y" to be honest. |
| 2021-05-11 21:38:17 | <ski> | @let instance Fractional a => Fractional (rho -> a) where (f / g) r = f r / g r; recip f r = recip (f r); fromRational q r = fromRational q |
| 2021-05-11 21:38:18 | → | dpl__ joins (~dpl@77-121-78-163.chn.volia.net) |
| 2021-05-11 21:38:19 | <lambdabot> | Defined. |
| 2021-05-11 21:38:20 | <geekosaur> | hasn't recognized it as something that can be used this way, perhaps |
| 2021-05-11 21:38:42 | <Ernest> | I definitely understand what that is when I see it in the types and im writing the type signatures, but I always thought it was just a very barebones primitive that isn't accesable to the programmer |
| 2021-05-11 21:38:42 | → | mounty joins (~mounty@236.216.214.218.sta.wbroadband.net.au) |
| 2021-05-11 21:39:15 | <ski> | > map (id^2 + id + 1) [-3 .. 3] -- polynomial evaulation |
| 2021-05-11 21:39:17 | <lambdabot> | [7,3,1,1,3,7,13] |
| 2021-05-11 21:39:55 | → | asimons04[m] joins (asimonsptz@gateway/shell/matrix.org/x-vwzhyungsgponujs) |
| 2021-05-11 21:39:58 | → | mjlbach joins (atriusmatr@gateway/shell/matrix.org/x-lfekbmgcuardpmmm) |
| 2021-05-11 21:40:09 | <ski> | > map (cos^2 + sin^2) [-pi,-pi/2,0,pi/2,pi] |
| 2021-05-11 21:40:11 | <lambdabot> | [1.0,1.0,1.0,1.0,1.0] |
| 2021-05-11 21:40:21 | <Ernest> | Creating a functor instance for the (->) type was just unthinkable cause it didnt' even seem like a data type |
| 2021-05-11 21:40:48 | <monochrom> | If you delete "data" there, everything makes sense. |
| 2021-05-11 21:41:12 | <Cajun> | im trying to build parconc-examples for the Parallel and Concurrent Programming in Haskell textbook, but it just will not ever build with stack (but it builds just fine with cabal alone). im deeply confused why it wouldnt work. heres the paste link thingy: https://paste.tomsmeding.com/glsJbPZe |
| 2021-05-11 21:41:13 | × | dpl_ quits (~dpl@77-121-78-163.chn.volia.net) (Ping timeout: 240 seconds) |
| 2021-05-11 21:41:15 | <ski> | > [[(fst^2 + fst*snd + snd^2) (x,y) | y <- [-2 .. 2]] | x <- [-2 .. 2]] -- multivariate polynomial |
| 2021-05-11 21:41:17 | <lambdabot> | [[12,7,4,3,4],[7,3,1,1,3],[4,1,0,1,4],[3,1,1,3,7],[4,3,4,7,12]] |
| 2021-05-11 21:41:59 | <Ernest> | Can things that are not data types be in the type signatures? Is Integer not a data type? |
| 2021-05-11 21:41:59 | <monochrom> | If you can have "f :: Either Int Bool" and "x :: Bool -> Int", then both "Either Int Bool" and "Bool -> Int" are types. |
| 2021-05-11 21:42:39 | ski | . o O ( `fmap x f' ) |
| 2021-05-11 21:42:43 | <Ernest> | Oh I would've considered "Either Int Bool" as data types |
| 2021-05-11 21:42:50 | <monochrom> | And in "instance Functor (...)", the only requirements for the ... there are: it is a type, and the type's rank is * -> * |
| 2021-05-11 21:42:56 | <ski> | types are not just data types |
| 2021-05-11 21:43:10 | <monochrom> | There is for example no requirement about "it is a user-defined type". |
| 2021-05-11 21:43:12 | → | olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber) |
| 2021-05-11 21:44:30 | <monochrom> | s/rank/kind/ |
| 2021-05-11 21:44:34 | × | jluttine quits (~jluttine@85-23-66-6.bb.dnainternet.fi) (Ping timeout: 252 seconds) |
| 2021-05-11 21:44:34 | × | opqdonut quits (opqdonut@pseudo.fixme.fi) (Ping timeout: 252 seconds) |
| 2021-05-11 21:45:05 | <nineonin_> | is there a right-biased Map.unions? |
| 2021-05-11 21:45:09 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:692a:95b:a9cd:2f9) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-11 21:45:09 | <ski> | `(->)' is a language primitive, just like `Char',`Int',`Integer',`Float',`Double',`Array',`IO',`Handle',`IORef',`IOArray',`ST',`STRef',`STArray',.. are -- but all these are still types |
| 2021-05-11 21:45:16 | × | rzmt quits (~rzmt@87-92-180-112.rev.dnainternet.fi) (Ping timeout: 260 seconds) |
| 2021-05-11 21:45:16 | × | Moyst quits (~moyst@212-149-213-144.bb.dnainternet.fi) (Ping timeout: 260 seconds) |
| 2021-05-11 21:45:26 | <nineonin_> | or how can I make it right-biased |
| 2021-05-11 21:46:33 | → | opqdonut joins (opqdonut@pseudo.fixme.fi) |
| 2021-05-11 21:46:38 | <Ernest> | Is there any way to inspect say, ((->) Int) in ghci? |
| 2021-05-11 21:47:04 | <Ernest> | like you can kinda do :t on a value or data constructor |
| 2021-05-11 21:47:05 | → | Moyst joins (~moyst@212-149-213-144.bb.dnainternet.fi) |
| 2021-05-11 21:47:09 | <ski> | Ernest : also, note that there is `instance Functor [] where ...', where the type `[T]' is syntactic sugar for the ordinary prefix application notation `[] T' |
| 2021-05-11 21:47:12 | <hpc> | :k ((->) Int) |
| 2021-05-11 21:47:13 | <lambdabot> | * -> * |
| 2021-05-11 21:47:16 | <hpc> | Ernest: ^ |
| 2021-05-11 21:47:27 | <ski> | @kind (->) Int |
| 2021-05-11 21:47:28 | <lambdabot> | * -> * |
| 2021-05-11 21:47:32 | <ski> | @kind Either Int |
| 2021-05-11 21:47:33 | <lambdabot> | * -> * |
| 2021-05-11 21:47:34 | <hpc> | as :t is "what's the type of this value", :k is "what's the kind of this type" |
| 2021-05-11 21:47:56 | <Ernest> | Ahhh cool |
| 2021-05-11 21:47:57 | <ski> | @kind (->) |
| 2021-05-11 21:47:58 | <lambdabot> | * -> * -> * |
| 2021-05-11 21:49:07 | × | nut quits (~gtk@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 245 seconds) |
All times are in UTC.