Search Haskell Channel Logs

Friday, February 10, 2017

#haskell channel featuring Jello_Raptor, monochrom, geekosaur, Boomerang, glguy, ezyang, and 6 others.

Jello_Raptor 2017-02-10 11:45:12
I'd really just like to be able to use type families as type functions :/ but the requirement that they have to be fully applied means I have to wrap everything in random new datatypes
Jello_Raptor 2017-02-10 11:45:36
and then use typeclasses and pattern synonyms to abstract over all that
monochrom 2017-02-10 11:48:09
I am reading the code and I think I'm more lost than before reading. What does "shared constructors" mean?
monochrom 2017-02-10 11:49:12
Rather, how would I use (not implementer) shared constructors?
glguy 2017-02-10 11:52:48
Jello_Raptor: What version of GHC are you using?
glguy 2017-02-10 11:53:34
Oh, I see, the top version isn't expected to work
Jello_Raptor 2017-02-10 11:53:42
monochrom: "shared constructors" is a bad name. I'm trying to solve that problem where you have 15 versions of effectively the same data structure "data Foo1 = A1 Int | B1 Bool","data Foo2 = A2 String | B2 String", etc..
Jello_Raptor 2017-02-10 11:54:23
glguy: the last bit works in 8.0.1 (barring some incomplete pattern match warnings)
monochrom 2017-02-10 11:55:28
No, Foo1 and Foo2 look dissimilar to me. Unless I should abstract away enough so that Foo1 is Either Int Bool and Foo2 is Either String String. In which case you already have Left and Right.
monochrom 2017-02-10 11:56:40
Left replaces A1 and A2. Right replaces B1 and B2.
monochrom 2017-02-10 11:57:06
The overarching type is "Either a b"
Jello_Raptor 2017-02-10 11:57:22
monochrom: mm? they have the same shape, many operations over them are going to be the same, they just store different values. Also that's just an example, the actual types I'm working with are complex and recursive, they're fundamentally ASTs for a DSL
lpaste_ 2017-02-10 11:57:28
glguy annotated "Datatype with shared structure?" with "Datatype with shared structure? (annotation)" at http://lpaste.net/352341#a352343
glguy 2017-02-10 11:57:58
Jello_Raptor: how about that?
monochrom 2017-02-10 11:58:04
Sure. Let me show you something I wrote for a "very general type for expressions"
monochrom 2017-02-10 11:58:34
Pardon the mult-line right in the channel.
monochrom 2017-02-10 11:58:36
data Term q o v = BV !Int -- ^local variable, de Bruijn 0-based index
monochrom 2017-02-10 11:58:36
| FV v -- ^free variable
monochrom 2017-02-10 11:58:36
| A { operator :: o, operands :: [Term q o v] }
monochrom 2017-02-10 11:58:36
-- ^compound term; application; leaf term (empty operands)
monochrom 2017-02-10 11:58:36
| Q { quantifier :: q, varname :: v, body :: Term q o v }
monochrom 2017-02-10 11:58:37
-- ^quantified term
monochrom 2017-02-10 11:58:49
See I have 3 type variables q, o, v there?
monochrom 2017-02-10 11:59:39
So I can have a million special cases beginning from "Term String ByteString Text", "Term Int Char ()", "Term ByteString Text Bool", ... etc etc
Jello_Raptor 2017-02-10 11:59:42
monochrom: yes, I know how to use type variables :P the problems start happening when I have a dozen of them being thrown around.
monochrom 2017-02-10 12:00:14
OK, buy a wider monitor if you have 12 type variables?
ezyang 2017-02-10 12:00:33
Jello_Raptor: Clearly, you should use Backpack ;)
ezyang 2017-02-10 12:00:48
One of the problems it solves is eliminating type variables
EvanR 2017-02-10 12:01:27
Term q o v... you just covered pretty much every formal language
monochrom 2017-02-10 12:01:33
YES!
monochrom 2017-02-10 12:02:03
And I have a unification function that works without knowing q, o, v! (But needs Eq etc)
merijn 2017-02-10 12:02:10
monochrom: *pedantic complaint that you miscapitalised De Bruijn*
monochrom 2017-02-10 12:02:30
Wait, I need De there?
monochrom 2017-02-10 12:02:42
Do you have a citation?
EvanR 2017-02-10 12:03:08
duh bruijns
merijn 2017-02-10 12:03:25
monochrom: Two rules in Dutch: Rule 1) First letter of a name is always capitalised, 2) "tussenvoegsels" (connectors, I suppose?) are not capitalised. With rule 1 trumping 2
merijn 2017-02-10 12:03:42
monochrom: So "Nicolaas Govaert de Bruijn", but "De Bruijn-indices"
monochrom 2017-02-10 12:04:02
Yikes. I need a drink.
merijn 2017-02-10 12:04:16
monochrom: Which pretty much the entire computer science world gets wrong, but I won't stop my pedantic crusade!
monochrom 2017-02-10 12:04:23
Fixed in my file now.
merijn 2017-02-10 12:04:49
(or "N.G. de Bruijn" if using initials)
monochrom 2017-02-10 12:05:15
Well at least you have rules. English doesn't.
monochrom 2017-02-10 12:05:32
English is of the absurd opinion "the exception proves the rule"
merijn 2017-02-10 12:05:44
Reading "Something, something de Bruijn" feels like when you misjudge the number of steps on stairs
merijn 2017-02-10 12:06:06
monochrom: Oh, we have so many exceptions to the rules, we actually have rules for the exceptions. Then have exceptions on those, because fuck logic
monochrom 2017-02-10 12:06:11
I understand. I get that all the time even with just pure English.
EvanR 2017-02-10 12:06:23
Pure English Systems
merijn 2017-02-10 12:06:49
Of course the whole internet is running amok with our traditional naming scheme anyway
monochrom 2017-02-10 12:06:50
"There exists a monster for all people" you don't even know how to parse it.
monochrom 2017-02-10 12:07:11
(Oh, you do know that a parse exists.)
EvanR 2017-02-10 12:07:13
i object, not all binding forms are quantifying
merijn 2017-02-10 12:07:40
International software like Blackboard, etc. screws up everything because it has no regards for locale specific naming conventions
merijn 2017-02-10 12:08:03
Such as the fact that when alphabetically sorting names "De Bruijn" should go under 'B'
merijn 2017-02-10 12:08:27
This whole computer and internet thing was a mistake!
monochrom 2017-02-10 12:09:20
I suppose my IRC connection should disappear now in a puff of logic.
merijn 2017-02-10 12:09:56
In a slightly more haskelly issue. cabal claims to be unable to resolve my dependencies, despite my code having only 3 and I don't understand why
Rembane 2017-02-10 12:10:13
merijn: And you don't understand why your code only has three dependencies?
merijn 2017-02-10 12:10:25
(2 of those dependencies are base and stm)
merijn 2017-02-10 12:10:27
http://lpaste.net/352346
merijn 2017-02-10 12:10:37
Rembane: No, I don't understand why cabal can't figure it out
Rembane 2017-02-10 12:10:40
merijn: Oh.
monochrom 2017-02-10 12:10:57
I'm thinking I may dislike Backpack because it relies so much on the spirit of implicit parameters.
Rembane 2017-02-10 12:11:00
merijn: I thought I had a nice clue there for a while.
merijn 2017-02-10 12:11:30
I mean, can't get more trivial than this....
EvanR 2017-02-10 12:11:49
gotta love explicit parameters, especially in agda when youre trying to do the most basic thing in category theory
EvanR 2017-02-10 12:11:59
entire page of parameters
monochrom 2017-02-10 12:12:14
What is "global constraint"?
dcoutts 2017-02-10 12:13:06
merijn: got the .cabal file ?
merijn 2017-02-10 12:14:06
dcoutts: http://lpaste.net/352346
Boomerang 2017-02-10 12:14:07
What would be simple and easy to setup Haskell package giving access to keyboard events (key presses and releases)?
dcoutts 2017-02-10 12:14:49
merijn: is this classic cabal, or using a sandbox, or new-build?
merijn 2017-02-10 12:14:55
dcoutts: sandbox
dcoutts 2017-02-10 12:15:12
merijn: were things installed already? e.g. vector
glguy 2017-02-10 12:15:42
Jello_Raptor: Did you see my message?
dcoutts 2017-02-10 12:16:16
merijn: it's not obvious to me why it's not tried some other versions of things. Certainly it's right that with the latest version of vector it's not going to work. You can try --max-backjumps=-1.
merijn 2017-02-10 12:16:47
dcoutts: I didn't install anything inside the sandbox (I just created it)
dcoutts 2017-02-10 12:16:54
hmm ok
merijn 2017-02-10 12:17:01
dcoutts: And I didn't think the global package db should be relevant?
dcoutts 2017-02-10 12:17:23
the global one is relevant, but the user one is not
merijn 2017-02-10 12:17:43
Oh, I never install global global
merijn 2017-02-10 12:17:46
Just user
geekosaur 2017-02-10 12:17:47
Boomerang, sdl2 might be the easiest
merijn 2017-02-10 12:18:46
dcoutts: global package db seems to only be GHC boot libs, certainly doesn't have vector
merijn 2017-02-10 12:19:02
dcoutts: oh, max-backjumps=-1 seems to have worked?
dcoutts 2017-02-10 12:19:17
merijn: so the solver reports the shortest error, which means it's not always clear what else it tried. You can explore it by using --max-backjumps=-1 and try forcing things like --constriant='vector < 0.12' etc
merijn 2017-02-10 12:19:41
At least, it's installing stuff and my lap is getting hot... >.>
dcoutts 2017-02-10 12:19:47
merijn: what cabal version btw?
dcoutts 2017-02-10 12:19:58
we increased the default backjumps limit at some point
merijn 2017-02-10 12:20:10
cabal-install 1.22.6.0 and Cabal 1.22.4.0
Boomerang 2017-02-10 12:20:18
Thanks geekosaur I might give that a go, any FRP library that works well with sdl2?
geekosaur 2017-02-10 12:20:28
that I don't knoiw
dcoutts 2017-02-10 12:20:40
merijn: ok, iirc it got increased in 1.24 (which also has the new-build preview/beta)
geekosaur 2017-02-10 12:20:56
if you want FRP you will probably be forced into whatever the FRP framework you choose wants to use, so you're doing this backwardsw
merijn 2017-02-10 12:21:18
dcoutts: Yeah, at some point I should probably move to GHC8 and newer cabal, but so far I've been too lazy to turn my laptop in a toaster for 3 hours rebuilding the world :p
dcoutts 2017-02-10 12:21:40
merijn: cabal can be upgraded independently of ghc
merijn 2017-02-10 12:22:21
dcoutts: Yeah, but I have ghc-mod which links with both cabal and ghc atm, so either way stuff breaks and I'd rather break it all at once :)
Boomerang 2017-02-10 12:22:30
geekosaur: right, I'm probably doing this backwards, but maybe FRP is overkill for my purposes anyway. Thanks!
sm 2017-02-10 12:23:28
Boomerang: also gloss
Boomerang 2017-02-10 12:23:43
Oh yeah, that's a simple API