!hskonBonfjiIefqLUV:matrix.org

Haskell

2451 Members
An advanced, purely functional programming language, haskell.org • log: view.matrix.org/alias/%23haskell:matrix.org • spam ? call @mods • more rooms: #haskell:libera.chat, #haskell-space:matrix.org • see also: haskell-links.org, twitter.com/HaskellOrg218 Servers

Load older messages


SenderMessageTime
27 May 2023
@n.daniel:matrix.orgn.danielI wonder18:46:53
@n.daniel:matrix.orgn.danielWhy do we model ML models in Python18:47:08
@n.daniel:matrix.orgn.danielI'd imagine something functional would be a better fit18:47:21
@n.daniel:matrix.orgn.danielA graphic for >>= of the state monad really reminded me of stateful ML18:48:20
@n.daniel:matrix.orgn.danielTransformers, I think18:48:37
@hsenag:matrix.orgHeffalump
In reply to @21it:matrix.org
I'm just playing around. Always was curious how this magic does work. Just as simple example I want to build a transpiler from Haskell (just simple Haskell, small subset) into Gleam, which is a simple typed language with very minimalistic syntax.
If you want the end result to be readable code you'd be best off starting with the source AST
19:35:34
@ic.rbow:matrix.orgic.rbow
In reply to @n.daniel:matrix.org
A graphic for >>= of the state monad really reminded me of stateful ML
You don't need state to build a network. It just a bunch of functions, really.
19:36:47
@ic.rbow:matrix.orgic.rbowThere are a few implementations. Native and TF.19:37:02
@n.daniel:matrix.orgn.daniel
In reply to @ic.rbow:matrix.org
You don't need state to build a network. It just a bunch of functions, really.
For recurrent networks you do afaik
19:37:05
@n.daniel:matrix.orgn.danielAt the very least the transformers with their hidden state remind me of the state monad19:37:22
@ic.rbow:matrix.orgic.rbowhttps://hackage.haskell.org/package/grenade19:38:03
@n.daniel:matrix.orgn.danielThat's quite neat, thanks for the link19:38:29
@n.daniel:matrix.orgn.danielLooking at the code, it looks intimitating19:41:04
@n.daniel:matrix.orgn.danielBut on closer look, I don't think its that bad19:41:14
@n.daniel:matrix.orgn.danielProbably a combination of being used to imperative programming and Python hiding the types19:41:40
@21it:matrix.org@21it:matrix.org
In reply to @n.daniel:matrix.org
Looking at the code, it looks intimitating
There is a lot of advanced type-level stuff in this library. It's not bad, but in my experience (from working with a bit less experienced haskellers in a team) singletons and dependent types are the things which you will start to appreciate only when you hit the limitations of the standard (Haskell 98 or Haskell 2010) "boring" type systems. In all the other cases coerce goes brrrr.
20:11:09
@21it:matrix.org@21it:matrix.orgHow wide is the code compexity range (from "boring" to "advanced") in Haskell is really impressive (comparing with simpler languages like Erlang).20:15:47
@scholabalde:matrix.orgscholablade

I would if someone would explain this: Here is an expression: ``` head ’ :: [ a ] -> a head ’ [] = error " Can ’ t call head on an empty list , dummy ! " head ’ ( x : _ ) = x ``` Calling the function: ``` ghci > head ’ [4 ,5 ,6] 4 ``` Considering that we only pattern matched for (x: _), rather than (x: _: _), why aren't we getting an error?

22:23:28
@scholabalde:matrix.orgscholablade *

I would if someone would explain this:
Here is an expression:

head ’ :: \[ a \] -> a
head ’ \[\] = error " Can ’ t call head on an empty list , dummy ! "
head ’ ( x : \_ ) = x

Calling the function:
```
ghci > head ’ [4 ,5 ,6]
4
```
Considering that we only pattern matched for (x: _), rather than (x: _: _), why aren't we getting an error?

22:24:06
@scholabalde:matrix.orgscholablade *

I would if someone would explain this:
Here is an expression:

head ’ :: \[ a \] -> a
head ’ \[\] = error " Can ’ t call head on an empty list , dummy ! "
head ’ ( x : \_ ) = x

Calling the function:

ghci > head ’ \[4 ,5 ,6\]
4

Considering that we only pattern matched for (x: _), rather than (x: _: _), why aren't we getting an error?

22:24:17
@scholabalde:matrix.orgscholablade *

I would if someone would explain this:
Here is an expression:

head ’ :: [ a ] -> a
head ’ [] = error " Can ’ t call head on an empty list , dummy ! "
head ’ ( x : _ ) = x

Calling the function:

ghci > head ’ [4 ,5 ,6]
4

Considering that we only pattern matched for (x: _), rather than (x: _: _), why aren't we getting an error?

22:24:48
@geekosaur:matrix.orggeekosaurbecause the list matched is (4 : [5,6])22:25:04
@scholabalde:matrix.orgscholabladeWhat do you mean? It's [4, 5, 6]22:25:54
@geekosaur:matrix.orggeekosaur or if you prefer, (4 : (5 : (6 : []))) 22:26:08
@geekosaur:matrix.orggeekosaur the [] form is a convenience; the actual format of a list is (head : tail) where tail is the rest of the list 22:27:12
@geekosaur:matrix.orggeekosaur so [4,5,6] is (4 : [5,6]) is (4 : (5 : (6 : []))) 22:27:58
@scholabalde:matrix.orgscholabladeMakes sense, i appreciate the help!22:28:19
@scholabalde:matrix.orgscholablade *

I wish someone would explain this:
Here is an expression:

head ’ :: [ a ] -> a
head ’ [] = error " Can ’ t call head on an empty list , dummy ! "
head ’ ( x : _ ) = x

Calling the function:

ghci > head ’ [4 ,5 ,6]
4

Considering that we only pattern matched for (x: _), rather than (x: _: _), why aren't we getting an error?

22:36:04
@simonmic:matrix.orgsmhttps://haskell.foundation/hs-opt-handbook.github.io , now transferred to the Haskell Foundation.. awesome23:19:52
@simonmic:matrix.orgsm * https://haskell.foundation/hs-opt-handbook.github.io from IOG, and now transferred to the Haskell Foundation.. awesome23:20:18

There are no newer messages yet.


Back to Room ListRoom Version: 5