Cale 2017-03-07 16:48:47
johnw: I don't really understand the question -- they talk about the construction of free monads in that paper.
monochrom 2017-03-07 16:52:10
Perhaps the abstract is better rewritten as "FreeT has been in use by practical people for a while. This paper aims to introduce this concept to theorists." :)
monochrom 2017-03-07 16:52:52
(Afterall, functional programmers regularly reading JFP?! Are you kidding me?)
Cale 2017-03-07 16:53:58
Heh, looks like that to me, yeah
haskull 2017-03-07 16:57:17
i dont know what they're called.. like State Int Int, for example.
peddie 2017-03-07 16:57:32
"s" and "a"
Cale 2017-03-07 16:57:38
haskull: The first is the type of the state which is manipulated during the computation, and the second is the type of the result of the action.
monochrom 2017-03-07 16:57:41
OK, the State type.
Cale 2017-03-07 16:58:17
So what do you mean by "use the state as a separate value"?
Cale 2017-03-07 16:58:32
Perhaps it would help if we could see what your code looks like
monochrom 2017-03-07 16:59:02
Next, I don't understand "use the state as a separate value". But the bottomline is, if your code compiles and gives the right answer, you are doing it right.
Cale 2017-03-07 16:59:09
Note that you can choose any type at all that you like to be the type of state being manipulated, so in particular, it might be a record consisting of a bunch of independent things
monochrom 2017-03-07 16:59:38
Actually maybe I only mean the converse. If your code has a type error or gives the wrong answer, then you have wrong concept.
haskull 2017-03-07 17:03:16
alright, thanks.
Cale 2017-03-07 17:03:24
From that description, it shouldn't be too hard to imagine using State, but it also might not improve things much, depending on the details
Cale 2017-03-07 17:03:41
You could have a pair of lists as the 's' type
Cale 2017-03-07 17:04:37
But then again, you might just be able to write a function which takes those two lists being manipulated as arguments, and which applies itself to new arguments according to how the lists are to be updated.
Cale 2017-03-07 17:04:49
(does that make sense?)
Cale 2017-03-07 17:05:27
The main way in which variables vary is to be bound to new things when a function is applied to new arguments.
haskull 2017-03-07 17:06:00
the part about tupling the 2 lists makes sense
haskull 2017-03-07 17:06:24
i think it'd work
Cale 2017-03-07 17:08:36
> let f xs ys [] = (xs,ys); f xs ys (u:us) = if even u then f (u:xs) ys us else f xs (u:ys) us in f [] [] [1..10]
lambdabot 2017-03-07 17:09:02
([10,8,6,4,2],[9,7,5,3,1])
Cale 2017-03-07 17:09:02
^^ have a look at how that thing manipulates the lists xs and ys, adding the next element to be processed to one or the other depending on whether it's even.
haskull 2017-03-07 17:10:18
i see. thanks, i think i can figure it out now.
Ptival 2017-03-07 17:16:56
DuplicateRecordFields is weird http://paste.awesom.eu/2GTa
johnw 2017-03-07 17:17:25
Cale: what I mean is, in 2015 what is it adding?
Ptival 2017-03-07 17:17:41
the reason given in the wiki ("we do not infer the type of the argument to determine the datatype, or have any way of deferring the choice to the constraint solver") is disappointing
johnw 2017-03-07 17:17:46
Cale: or is it just clarifying the intersection between FreeT constructions and f-and-m-algebras?
cris_ 2017-03-07 17:40:27
hi, i write up some code on dates, could you check if any could be improved? https://github.com/szehk/Haskell-Carbonara-Library/tree/master/src/Data/Carbonara