« first day (1818 days earlier)      last day (3132 days later) » 

8:02 PM
I did sth clever with application and composition for the first time (i.e. I didn't throw in a lambda as usual) yay
Data.List.find ((==2) . fst) to search in a list of tuples
 
@JohanLarsson nah that's emacs
 
gah\
I always forget traversed when dealing with maps
thank you type system
 
8:17 PM
For vim you just have a tentacle to quickly press Esc+:
 
Sublime Text 3 generates insane amounts of tempfiles, disabling autosave did not do much
 
so, my Lua VM can already eval return 1 + 1
I'm so proud :3
 
user1804599
exciting
 
Haha, people protesting against Renoir.
 
@elyse I now need to write something using Typeable
 
user1804599
8:19 PM
ok
 
to automatically convert Haskell functions to Lua functions
 
user1804599
Haskellua
 
stack overflow > my logins > stack exchange > change password
results in an error message about email []
password:Invalid email []
where would I post such a question.
 
@AlexM. Are W3 related pings allowed now? :P
 
yep
 
8:29 PM
And yes, I am so ready (although I've consciously been avoiding most trailers and details)
 
what kind of black magic must I do to add two Maybe Doubles and get a Maybe Double
I've been playing with fmap to no avail
 
(+) <$> a <*> b
@AlexM. Functor alone is not enough. You need Applicative.
 
lemme read on that, thanks
 
Note that (<$>) is an alias for fmap. So you can see how with just one Maybe a value, we can get away with just Functor. (<*>) comes from Applicative and comes into play from the second Maybe b on.
@AlexM. If that’s too much too handle, you can close your eyes and go for do-notation: do { a <- ma; b <- mb; return $ a + b }.
For now that uses Monad, but for GHC 8.0 it’s slated to work down to Applicative where applicable(hah). The hierarchy goes Functor -> Applicative -> Monad, from less operations/capabilities to more ops/caps.
 
I think I can get what happens
 
8:35 PM
@AlexM. Hey I wouldn’t judge. Good for you.
Throwing stuff at GHC(i) to see what happens without understanding it is more than expected.
 
tests pass so I'm definitely going on the right path yay
evalExpression (Constant 5) [] `shouldBe` Just 5
evalExpression (Variable "abc") [("abc", 32)] `shouldBe` Just 32
evalExpression (Variable "z") [("abc", 32)] `shouldBe` Nothing
evalExpression (Operation (Constant 5) Plus (Constant 7)) [] `shouldBe` Just 12
 
@AlexM. you need to lift (+)
 
@LucDanton yea I use ghci to try out everything before writing it in this thingy here
I like that it was so trivial to get something that evaluates expressions and lets you nest them like crazy
evalExpression (Operation (Operation (Constant 5) Plus (Constant 7)) Plus (Variable "c")) [("c", 45)] shouldBe` Just 57`
 
Early papers on applicative functors used a notation to suggest similarity to pure functions. I.e. the pure program f a b would become (| f xa xb |) when xa and xb were applicative values rather than pure values. Which is why I like f <$> x <*> y notation FTR.
 
basically this: data Expression = Constant Double | Variable String | Operation Expression Operator Expression pretty sure it can be done better but yea
 
8:40 PM
@AlexM. It can, but I suggest you run into issues/dissatisfaction before you try to improve. It’s a well-travelled road and the journey is fun, the lessons are likely to stick if you wait until then.
 
@BartekBanachewicz this? wiki.haskell.org/Lifting
 
@AlexM. ye
 
Seriously, task view, virtual desktops and keyboard shortcuts in the console make Windows 10 worth it.
 
@AlexM. heh I'm writing pretty much the same except for Lua. Isn't much different really.
 
@AlexM. The term is broad so you may also run into it in other contexts. As a heads-up so you don’t get confused then.
 
8:43 PM
how does one "log out" of SO?
 
@Jaden how can we log out of SO if Internet isn't real
 
@Jaden use the sign out function; or sign out of your linked (social) network account id
optionally revoke the federated access permission
 
@BartekBanachewicz That's not what I recommended back then
I recommended something like what Elm does
 
@ʎǝɹɟɟɟǝſ does Elm just use magic
 
oh, I am blind.
regardless, it is persistent and doesn't seem to have done anything.
vOv
 
8:49 PM
@BartekBanachewicz Kind of
Lens is good enough though.
 
user1804599
Your mother is a lens.
 
a magnifying one
 
user1804599
I'm bored.
 
user1804599
I wanna mock people but can't find victims.
 
IMockPeople
nope, not good
 
8:56 PM
@elyse Mock me ♥
 
@Morwenn ❤
 
user1804599
@Morwenn lolno you can't even pick a pronoun LOL loser
 
I'm pro-noun
Nouns should have civil rights
 
user1804599
also I hate these things
 
user1804599
when people explicitly ask you to make fun of them or say bad things about them
 
user1804599
8:58 PM
and so you do that
 
user1804599
and then they get angry at you
 
user406009
It's almost as bad as those "What's your greatest weakness?" interview questions.
 
user1804599
 
user406009
I just had one of those last week.
 
user1804599
@Lalaland I'd say my greatest weakness is telling other people what my greatest weakness is.
 
user1804599
9:00 PM
Or "answering moronic questions like this one."
 
@elyse That's because all of them suit me :3
 
user406009
@elyse Yes. But I actually wanted that job.
 
user1804599
suits are for losers, so I suppose that indeed suits you!
 
Good evening.
 
user1804599
 
user406009
@Morwenn So, are you helicopter-kin now?
 
@Nooble wellcum, my firand, to the land of glorious phaggets
 
@Lalaland No :(
 
You might have noticed an unusually high amount of plinks
 
This is abnormal.
 
9:02 PM
To be honest, I don't mind « he », but I think I always like « she » a bit more.
@elyse I never whore a suit.
 
user1804599
good
 
user1804599
suits suck
 
I have to agree.
One time during an interview I was told that not wearing a suit wasn't serious.
 
@AnalPhabet Did I ever say I was a boy?
 
9:04 PM
@Morwenn It wasn't serious-- ly stupid of you
 
@Morwenn lol you never what
 
@AndyProwl Good you noticed :p
 
@Morwenn Not according to the spider transcript, no
v0v
 
@AnalPhabet Yes.
Also 14 stars, not bad not bad.
 
9:06 PM
15 cant u read
 
Witness my genius at 6:30 AM.
 
@AnalPhabet We can't really say I'm a boy either actually.
 
@Morwenn drives off on the whatever train
 
@AnalPhabet Exactly, pick somewhere in the middle of the spectrum.
 
@Morwenn You'll always be The Mighty Helicopter to me
 
9:07 PM
@AnalPhabet I hate trains.
 
fuck I miss dependent types so much
 
Mighty Helicopter is above the spectrum.
 
I got stuck
 
@Nooble ping
 
there's no way to call a haskell fn from a list of values without metaprogramming I think
 
9:08 PM
metaporngrammar
@Morwenn 'S why it's best
@LucDanton pong
 
@Nooble What's abnormal? :)
 
@BartekBanachewicz I think it's fundamentally mandatory for that kind of operation.
 
@Mysticial Hehe.
 
@Mysticial He got mass-invisiplinked today
 
Do not worry Mysticial, soon I'll have as much rep as you.
Just give me a few thousand years and the fountain of youth.
 
9:10 PM
Becum a vampirlel
 
user1804599
 
vampirlels > human+fountain-of-youth
 
@Puppy dependent types would allow that as well
 
@elyse Is it an ayyylien?
 
user1804599
ayyye
 
9:11 PM
Since I could make the type of the value conversion function dependent on the value of the function signature element
 
if I recall correctly
 
then the type would fit and I'd just apply recursively
 
dependent types don't apply to arbitrary TC code.
 
turing complete
 
9:12 PM
TotalCommander, duh
 
@Puppy I am pretty sure it would work in this case
 
user1804599
You can have dependent types in a Turing-complete language just fine.
 
@AnalPhabet W I N R A R
 
how could the compiler possibly infer the type of a value when the code producing that value isn't even known until runtime?
 
it's really about proving "a function called on this value will return a value of that type which in turn can be applied to this function requiring this exact specific type"
 
user1804599
9:13 PM
The runtime value isn't part of the type.
 
Nobody knows.
 
@Puppy are you asking "how do dependent types work" now?
see my message above
 
that really doesn't explain it.
 
user1804599
let x = rand();
let y = rand();

let a: list x = ...;
let b: list y = ...;
 
since you don't know "this value" in the slightest.
 
user1804599
9:14 PM
Here, a and b have different types, even though x and y may be equal at runtime.
 
@Puppy it does, you're just having trouble comprehending
don't worry it's not a simple concept
 
@Nooble Whimsically Interpreting Nooblet Random Archived Roombas
 
the principle of a value being able to be of a more specific type, more or less, is not that tricky.
 
user1804599
If you want a and b to be of the same type, you have to prove x = y to the type checker.
 
it's how you could possibly make that work for values which are not known until runtime.
 
9:15 PM
@Puppy this is not about that
 
Ell
dependent typing is really cool
 
user1804599
For example: if x == y { let a: list x = ...; let b: list y = ...; ... }.
 
@AnalPhabet WinRAI?
WinRAII.
 
@Puppy that's the real magic
 
if you write a Lua interpreter, your caller could load completely random crap in there.
 
user1804599
9:15 PM
Here, the compiler can tell that a and b indeed have the same type.
 
they could put in any arbitrary value.
 
@Nooble whoops
 
@Puppy you're stuck thinking in non-dependent-typing terms
 
user1804599
Maybe you should use a dependently typed language instead of dunning-krugering.
 
user1804599
Wait, why did I unplonk you again
 
user1804599
9:16 PM
it's the same useless discussion as always.
 
@elyse who is that directed at
 
user1804599
puppy
 
I agree, trying to hold a sane rational discussion about it is so tremendously stupid
I'm clearly just flaming the room out right now.
 
why
 
9:17 PM
anyway, ignoring elyse
I don't see how you can prove anything about a value from Lua when the user can load in random turing-complete Lua code.
I can't imagine anything more arbitrary than that.
 
f 1 :: A
f _ :: B

g :: Int -> [A]
g = map (\x -> if x == 1 then f x else defaultA)
 
user406009
@BartekBanachewicz What exactly are you trying to do?
 
@Lalaland your mom
 
@BartekBanachewicz Seems to me like that's more like a dynamic cast than anything else.
 
@Puppy it can be verified statically.
 
9:20 PM
so can dynamic cast, at least to that extent.
 
Ell
I think I'll order a T450s as soon as my moolah comes in
 
@Puppy no, it can't. A dynamic cast might fail. f 1 can't.
 
by the time you call f 1 you already did the cast.
 
x == 1 can fail just like dynamic cast.
x == 1 is effectively the dynamic cast here.
 
user1804599
9:21 PM
I want dependent types for division.
 
@Puppy can you tell me how?
it can either return true or false.
 
dynamic cast can return either null or non-null.
 
user1804599
Because partial functions suck, and division returning Maybe a is annoying. :P
 
ok, think about it this way
 
user406009
@elyse You could just use floating point :)
 
9:22 PM
you have a value x of type T, you say that if f(x) is true, then x is really of type U.
 
user1804599
@Lalaland Look, partial functions are annoying, Maybe a is even more annoying, and giving the wrong result is the most annoying.
 
@Puppy but this code is guaranteed by the compiler to work correctly. C++ code using dynamic_cast isn't.
it's really all about that.
 
the equivalent C++ with dynamic cast is guaranteed to work correctly.
 
no, the compiler can't assess that.
 
sure it can.
you handle the case where dynamic_cast returns null, and the case where it returns non-null.
it's a simple branch where both conditions are valid.
in fact, Typescript 1.6 has literal in-built language support for user-defined functions of this nature.
 
9:24 PM
@Puppy that would require inspection of your code of whether you actually do the check or not
C++ compiler doesn't do that.
 
@BartekBanachewicz The compiler for Haskell has to inspect your code to see if you have x == 1 or not.
 
@Puppy Haskell compiler doesn't do that either.
Haskell doesn't have a dependent type system
 
well, for any dependent type language which could compile the example you gave.
 
also, if x == 1 was just an example. A real DT languge can reason about much more.
 
so can Typescript.
 
9:25 PM
@Puppy yeah, and that's what differs the dependently typed languages from the non-DT ones
@Puppy no, I don't think TS has dependent types.
 
the C++ compiler must see the dynamic cast when it compiles your code.
 
Ell
puppers puppers puppers
 
so it knows whether or not you did the cast.
 
user1804599
TypeScript has no value-dependent types, no.
 
Ell
you need to get some education
 
9:26 PM
> If you try to divide by 0, the interpreter will pick a file at random and delete it. Make sure your always check your divisions.
 
user1804599
val div: int -> n:int { n > 0 } -> int
let div a b = a / b
 
@Puppy it doesn't because the action of the cast can't be determined until runtime.
 
Psychological typing.
 
user1804599
this kind of stuff is awesome
 
@BartekBanachewicz Right; but it doesn't matter what the result is.
 
user1804599
9:26 PM
sadly / takes nat, not int, in F* :v
 
@Puppy The C++ compiler can't assess that. In a way, it's just more permissive/does less checking.
 
yes it can.
it's trivial.
just compile both the true and false branches.
 
@elyse F* seemed cool :o
 
@Puppy it's not always that simple.
 
user1804599
it is :P
 
9:27 PM
and in the true branch, give x a different type.
 
Well, the C++ compiler can special case dynamic_cast
 
it's not always a simple "yes/no"
 
so what
 
the reasoners of DT langs deal with much more constructs
 
well, arguably, you can write your own functions like dynamic_cast.
 
9:28 PM
guess why they need stuff like Z3 to actually reason about your code
 
COM's QueryInterface, for example.
that's pretty manual work, I admit, but it ultimately produces the same outcome.
 
it doesn't.
 
ok, it ultimately produces the same outcome as dynamic_cast, assuming that you didn't cock it up.
 
It doesn't.
 
well it's true that DC is a lot more restrictive than QI.
 
9:29 PM
I've made a simplified example to ease your understanding but you assumed that simplified example is representative of all of the concepts in DT
 
hm
not really.
I'm not saying that everything in DT can be expressed as a dynamic cast.
I'm merely saying that there's nothing in that example that is more DT than anything else.
 
56 secs ago, by Bartek Banachewicz
I've made a simplified example to ease your understanding but you assumed that simplified example is representative of all of the concepts in DT
 
@BartekBanachewicz What, everything in DT can be expressed as a dynamic cast?
 
@Puppy missed the "not"
it's an example vOv. In this particular case the DC analogy works. It doesn't extend to all of it. That's all.
@Lalaland generate a conversion function from a Haskell function to a [Value] -> Value function
but I am pretty sure now that it requires metaprogramming which I was hoping to avoid
 
user1804599
My favourite Scala use cases for dependent types is preventing sharing nodes between two graphs through the type system, and preventing comparing monetary values in different currencies. :D
 
9:33 PM
so a simplified question of mine is
given a Value, and a function taking some type a, and a conversion from Value to Maybe a, and the TypeRep of a, can you call that function if you have a value?
 
sup bitches :)
 
user1804599
case class Currency(name: String) {
    case class Value(amount: Rational)
}
def compare(currency: Currency)(a: currency.Value, b: currency.Value) =
    a == b
val (usd, eur) = (Currency("USD"), Currency("EUR"))
val (a, b) = (usd.Value(1), eur.Value(1))
compare(usd)(a, b) // type error
 
user1804599
Types of a and b depend on the values usd and eur respectively.
 
sounds to me like you could use some reflection
 
meh
 
user1804599
9:35 PM
I think this is a nice simple example of dependent typing.
 
@TonyTheLion Sup, pussy.
#Nooble2015 guys, make it happen.
 
user1804599
It's visible in both the call (type error) and the callee (currency value appears in currency.Value type).
 
I kinda wish I didn't have to also parse this kind of stuff
 
user406009
Is it even possible to convert (a -> a -> ... -> b) to ([a] -> b) in Haskell easily?
 
user1804599
And unlike with templates, currency is not known at compile-time.
 
9:36 PM
@Nooble I'm alright. Sup with you?
 
x = 13 + (y = 3)
:16
now I have to add support for expressions with side effects ugh
 
@TonyTheLion Homework :D
 
@Nooble D:
 
user406009
@elyse That can be converted almost directly into C++ templates
 
9:37 PM
@Lalaland in compile time, I guess
 
user1804599
No, it cannot.
 
@AlexM. Monads!
 
@Rapptz It's what I use!
 
@BartekBanachewicz yea I'll use the state monad eventually because the interpreter has to keep state between commands
 
user1804599
With C++ templates, you need to know at compile-time the exact currency you're dealing with.
 
9:38 PM
Either that or consolas.
 
user1804599
With dependent types, you can pick a concrete currency at runtime.
 
user406009
@BartekBanachewicz How about you try solving that first, before you approach your other issues?
 
user1804599
As long as you can prove a and b belong to the same currency, the type checker is happy.
 
@Lalaland solving what?
 
@Nooble :D
 
user1804599
9:39 PM
There are of course programs for which this holds, but you can't prove it, and those are rejected.
 
user1804599
But that's the cost of type checking in general. Some correct programs are rejected.
 
I'm trying to fix build because adding Lens broke it
 
user406009
@BartekBanachewicz (a -> a -> ... -> b) to ([a] -> b)
 
@elyse If that definition is correct, it's the best definition ever
 
eh it's not really that useful for me
 
9:39 PM
thanks elyse
 
@Lalaland I need a way to implement Lua's stdlib with Haskell easily
 
@Lalaland No.
 
luaOpPlus :: NativeFunction
luaOpPlus ((Number a):(Number b):_) = return $ [Number (a + b)]
luaOpPlus _ = error "Plus operator takes exactly two numeric arguments"
 
user1804599
Dependent types allow more correct programs to be accepted and more incorrect ones to be rejected.
3
 
and this is just too tedious to type
 
9:40 PM
@BartekBanachewicz Use a macro :P
 
I'm trying to change my colour scheme/theme
 
user1804599
@BartekBanachewicz metatables!
 
since I'm bored of mine
 
@AnalPhabet lol actually
a macro might be a good idea
 
@elyse meatables?
 
9:41 PM
@elyse compile time master race
 
user1804599
The ideal type system would reject all incorrect programs and accept all correct ones.
 
@TonyTheLion macros are also compiletime :P
@elyse which is impossible, sadly
 
@BartekBanachewicz oh you :)
 
user1804599
But that's impossible for Turing-complete languages (see Halting problem).
 
but dependent types move us further on the lambda cube
I don't think we have anything better now in maths
 
user1804599
9:43 PM
inb4 HoTT solves all problems
 
#define LUA_BINARY_OP(name, type, op)                           \
  luaOp##name::NativeFunction                                   \
  luaOp##name((type a) : (type b) : _) = return $[type(a op b)] \
  luaOp##name _ = error #name " operator takes exactly two " #type " arguments"
 
yeah this could work
 
user1804599
eh
 
user1804599
you can make that a function
 
user1804599
doesn't have to be a macro
 
9:43 PM
@Lalaland Unless 'do whatever it takes to make it work, then package it as a nice library' counts as easy in the sense that it’s now easy for the users.
 
@elyse this needs template haskell :v
 
~~~macros~~~
 
user1804599
luaBinaryOp :: String -> (a -> a -> a) -> NativeFunction
luaBinaryOp name op (Numeric a) (Numeric b) = return [Number $ a `op` b]
luaBinaryOp name _ _ _ = error $ "fuck " ++ name ++ " bitches"
 
bullshit because works only for numbers
I'm gonna need functions of all types and that's the issue.
 
Funcitons? Funcitons!
 
user1804599
9:48 PM
try a typeclass :P
 
user1804599
Ada is really nice.
 
@Lalaland wut
 
user406009
NVM, that doesn't really save you any effort.
 
user406009
@BartekBanachewicz I think you have hit the point where additional generic programming is not worth the effort.
 
@Lalaland Rough outline of an approach: list to HList -> polyvariadic uncurry (either to HList directly, or to tuple then to HList) the function -> apply function to HList. The one piece I don’t know where to find is the poly uncurry. I wouldn’t describe any of those steps as 'easy'.
 
user1804599
9:50 PM
@LucDanton How about the same type class trick that printf does?
 
Heya
 
user1804599
Heya
 
Prelude Language.Haskell.TH> runQ [d| f = (+) |]
[ValD (VarP f_3) (NormalB (VarE GHC.Num.+)) []]
hey this actually makes sense
 
user1804599
There's this guy called Thomas and we call him TH Grannies because "omas" is Dutch for grandmothers.
 
9:51 PM
so it's a "Value Declaration" (ValD)
of something that's called "f_3"
 
which is a Normal form of GHC.Num.+
 
user406009
@BartekBanachewicz Just say no.
 
user1804599
Oh cool you can break minecarts with a cactus.
 
user1804599
That's really nice.
 
user406009
9:52 PM
A little copy + paste is much better than horrible amounts of metaprogramming.
 
user1804599
Because then you can have them drop into a hopper automatically, which can then transport them to a dispenser.
 
@Lalaland it's not "a little"
 
user1804599
That way you can quickly and compactly transport minecarts without rails.
 
@elyse Slowpoke
 
9:54 PM
@Rapptz What's so funny?
 
it's visual studio-looking :v
 
Ah, that
I guess
 
@Rapptz Stockholm Syndrome
 
@Lalaland horrible amounts of metaprogramming is always better :D
 
user1804599
@Rapptz lol
 
user1804599
9:55 PM
nice
 
GHC stage restriction:
      ‘f’ is used in a top-level splice or annotation,
      and must be imported, not defined locally
    In the splice: $$f
@Mr.kbok are you sure ^
 
user1804599
:p
 
user1804599
that's annoying
 
IRTA "the nuclear reactor core isn't supposed to be touched by noobs"
 
user1804599
and the reason I tend not to use TH for this kinds of stuff
 
9:56 PM
@elyse there's no alternative
 
Only n4451 identifier() madness level metaprogramming
 
user1804599
instead, I use a custom preprocessor ({-# OPTIONS_GHC -pgmL ... #-}) if possible
 
@Mr.kbok what's that?
 
Madness
I'm on mobile 📱 but Google it
 

« first day (1818 days earlier)      last day (3132 days later) »