!hskonBonfjiIefqLUV:matrix.org

Haskell

2803 Members
An advanced, purely functional programming language, haskell.org • log: https://view.matrix.org/room/!hskonBonfjiIefqLUV:matrix.org • spam ? call @mods • more rooms: #haskell-irc:matrix.org, #haskell-space:matrix.org • see also: haskell-links.org, twitter.com/HaskellOrg234 Servers

Load older messages


SenderMessageTime
25 Apr 2024
@geekosaur:matrix.orggeekosaurstrictness isn't what I'm after here. size and location of pointers14:40:15
@geekosaur:matrix.orggeekosaurthe GC information14:40:23
@bowuigi---now-more-based:kde.orgBowuigiThe C FFI might have that, unsure though14:41:39
@zeroidone:matrix.orgzeroid My Haskell-learning of today.
I am 63 years "old". When I play in ghci I feel like 16 or even younger (under 10).
runState ((,) <$> (get >>= put . succ >> return "hello" ) <*> (get >>= put . negate >> return "applicative")) 3
I wish we've had Haskell when in school.
17:04:37
@zeroidone:matrix.orgzeroid * I am 63 years "old". When I play in ghci I feel like 16 or even younger (under 10).
My Haskell-learning of today.
runState ((,) <$> (get >>= put . succ >> return "hello" ) <*> (get >>= put . negate >> return "applicative")) 3
I wish we've had Haskell when in school.
17:06:37
@sgillespie:matrix.orgSeanWell then programming was a lot harder when you were 10 in general17:06:49
@zeroidone:matrix.orgzeroidHaskell is not functional programming . Haskell is time-travelling and "fountain of youth" ("Jungbrunnen" in german). 😅17:10:49
@zeroidone:matrix.orgzeroid Some "improvement" / progress ...
runState (((++) . (++ " wonderfull Haskell ")) <$> (get >>= put . succ >> return "hello" ) <*> (get >>= put . negate >> return "applicative")) 3
18:24:47
@zeroidone:matrix.orgzeroid * Some "improvement" / progress ...
runState (((++) . (++ " wonderfull Haskell ")) <$> (get >>= put . succ >> return "hello" ) <*> (get >>= put . negate >> return "applicative")) 3
18:25:21
@sgillespie:matrix.orgSeanDefinitely better18:26:06
@zeroidone:matrix.orgzeroid * Some "improvement" / progress ...
runState (((++) . (++ " wonderfull Haskell ")) <$> (get >>= put . succ >> return "hello") <*> (get >>= put . negate >> return "applicative")) 3
18:33:30
@alex:tunstall.xyzAlex
In reply to @zeroidone:matrix.org
Some "improvement" / progress ...
runState (((++) . (++ " wonderfull Haskell ")) <$> (get >>= put . succ >> return "hello") <*> (get >>= put . negate >> return "applicative")) 3

Some tips:

  • m >> return x can be replaced with m $> x or x <$ m
  • get >>= put . f can be replaced with modify f
  • (.) has higher precedence than (<$>)

Applied:

runState ((++) . (++ " wonderful Haskell ") <$> (modify succ $> "hello") <*> (modify negate $> "applicative")) 3
18:37:25
@alex:tunstall.xyzAlex
In reply to @zeroidone:matrix.org
Haskell is not functional programming . Haskell is time-travelling and "fountain of youth" ("Jungbrunnen" in german). 😅
This comment about time-travelling is surprisingly fitting.
See http://web.archive.org/web/20190430061601/https://lukepalmer.wordpress.com/2008/08/10/mindfuck-the-reverse-state-monad/
18:45:02
@zeroidone:matrix.orgzeroidCooooool. Thxs. ghci spits out some "horrible looking" (=terrifying 😅) error messages when I copy & paste your statement into it, Alex. But ... I guess ... I just need to import some module / library currently not loaded. Allright, let's go and find out why them are hiding from us (me & ghci). 😀18:47:40
@alex:tunstall.xyzAlexUhh I didn't test it so let me double check.18:47:58
@alex:tunstall.xyzAlex

It only needs two imports:

  • Control.Monad.Trans.State (without Trans is fine too if you have mtl installed)
  • Data.Functor for ($>)
18:50:52
@alex:tunstall.xyzAlex
In reply to @zeroidone:matrix.org
Cooooool. Thxs.
ghci spits out some "horrible looking" (=terrifying 😅) error messages when I copy & paste your statement into it, Alex.
But ... I guess ... I just need to import some module / library currently not loaded.
Allright, let's go and find out why them are hiding from us (me & ghci). 😀
In case you don't already know about it: Hoogle is a great tool for finding symbols defined in other modules (haskell-language-server can also suggest imports for missing symbols).
18:54:10
@zeroidone:matrix.orgzeroid Done!
:m + Data.Functor
(my) ghci sends greetings to Alex
18:58:12
@zeroidone:matrix.orgzeroid * Done!
:m + Data.Functor
(my) ghci sends best greetings to Alex
18:59:43
@alex:tunstall.xyzAlex

Don't be terrified by the length of GHC's error messages: they are rich with information.
(Explanation of the error, source location, any relevant context like the types of the variables in scope, suggestions for how to fix it, etc.)

Only the first line of an error message is truly essential.
GHC gives you all of it because often the context helps you understand what exactly the compiler's doing.

19:00:02
@zeroidone:matrix.orgzeroidAlex, the "problem" is not GHC's (error) messages. The problem is that I am an analphabet with respect to its language. But ... I will and want to master this language. 19:09:06
@alex:tunstall.xyzAlex Yes, reading them takes some getting used to.
That will come with experience.
19:09:29
@zeroidone:matrix.orgzeroid
In reply to @alex:tunstall.xyz
This comment about time-travelling is surprisingly fitting.
See http://web.archive.org/web/20190430061601/https://lukepalmer.wordpress.com/2008/08/10/mindfuck-the-reverse-state-monad/
Just opened the link.
"Mindfuck: The Reverse State Monad" ???
Definitely something I will look into tomorrow. Thxs.
19:15:41
@alex:tunstall.xyzAlex
In reply to @zeroidone:matrix.org
Just opened the link.
"Mindfuck: The Reverse State Monad" ???
Definitely something I will look into tomorrow. Thxs.
If after reading it you find yourself in need of a more thorough explanation of how reverse state works, you may want to read this detailed blog post about time travelling state.
19:22:01
@geekosaur:matrix.orggeekosaur https://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/ is another good one, although it's not about reverse state per se 20:26:32
@geekosaur:matrix.orggeekosaur https://github.com/quchen/articles/blob/master/loeb-moeb.md is another fun one, if you're looking for "impossible" data/control flow 21:19:53
@zeroidone:matrix.orgzeroidzeroid sends best greetings to geekosaur.22:01:46
@jecxjo:matrix.sh0.xyzjecxjo changed their profile picture.22:38:40
@tzlil:tzlil.nettzlil changed their profile picture.22:52:43
@rupalibangla_rahat:matrix.orgrupalibangla_rahat joined the room.23:43:48

There are no newer messages yet.


Back to Room ListRoom Version: 5