mbw 2017-03-07 11:53:01
Specifically, inside "allPermutations" for example. I have a function called addPrimes, which for a given list of labels, makes sure they are all unique. I found it most reasonable to implement it with a list. But if I had worked with nested lists instead of Lists of tuples, things would've been more error-prone, probably.
ertes 2017-03-07 11:54:31
this is weird… why didn't the instance work?
ertes 2017-03-07 11:56:54
:t \xs0 -> foldr (\x go xs -> if S.member x xs then False else go (S.insert x xs)) (const True) xs0 mempty
lambdabot 2017-03-07 11:56:54
(Foldable t, Ord a) => t a -> Bool
mbw 2017-03-07 12:01:39
I just hope I'm not talking about the wrong function here...
MarcelineVQ 2017-03-07 12:04:33
ertes: Generic1 is for * -> *
ertes 2017-03-07 12:04:38
MarcelineVQ: didn't work either, but i'm 100% sure that i've already used the generic (<*>) somewhere
ertes 2017-03-07 12:04:48
maybe i had an instance in scope i didn't realise came from somewhere outside of 'base'
MarcelineVQ 2017-03-07 12:04:51
oh? it worked for me just now :X maybe mine isn't rebuilding fresh
ertes 2017-03-07 12:04:58
perhaps from the generic-deriving library or something
ertes 2017-03-07 12:05:59
> pure sin <*> V2 3 5
lambdabot 2017-03-07 12:06:29
V2 0.1411200080598672 (-0.9589242746631385)
mbw 2017-03-07 12:07:48
Do people use this often? It doesn't look like it's easy.
ertes 2017-03-07 12:08:10
mbw: i use it a lot, mostly to avoid having to write Monoid instances for product types
lyxia 2017-03-07 12:10:03
pure sin looks evil.
ertes 2017-03-07 12:10:03
(which unfortunately requires the generic-deriving library, because (<>) is not defined genericly)
ertes 2017-03-07 12:10:03
haha
ertes 2017-03-07 12:10:03
perhaps (pure tan) looks more sunny
mbw 2017-03-07 12:10:03
There's always something new to learn. It's a shame they use fortran where I'm at.
freechips 2017-03-07 12:10:08
hey guys
freechips 2017-03-07 12:10:13
is anybody online?
freechips 2017-03-07 12:10:23
ive got a function with matches such as string -> int
freechips 2017-03-07 12:10:30
and id like to extend it in another function
freechips 2017-03-07 12:10:47
so like i have f1 = function "a"->1 | "b"->2 | ....
MarcelineVQ 2017-03-07 12:11:03
I can think of worse things than fortran, that being said it might be fun to write a haskell dsl that compiles to fortran
freechips 2017-03-07 12:11:04
and id like to have f2 = (f1 + "c"->3)
lyxia 2017-03-07 12:11:12
looks like OCaml
freechips 2017-03-07 12:11:16
oh shit
freechips 2017-03-07 12:11:18
sorry guys
freechips 2017-03-07 12:11:22
wrong channel
MarcelineVQ 2017-03-07 12:11:54
You'll be back :>
freechips 2017-03-07 12:11:58
i will
freechips 2017-03-07 12:12:02
but i need ocaml right now
freechips 2017-03-07 12:12:28
im determined to switch to haskell after ocaml
mbw 2017-03-07 12:13:30
MarcelineVQ Fortran can be as nice as any language. But of course you have to read other people's code more often than write your own...
mbw 2017-03-07 12:13:59
I guess on the other hand that clusterf* I posted isn't all that pretty either I guess :)
ertes 2017-03-07 12:14:36
i can read it
ertes 2017-03-07 12:14:36
that makes it good enough, because i ha… prefer not to read other people's code most of the time =)
mbw 2017-03-07 12:16:56
It's kind of hard to find a middle ground between applying obvious substitutions and maintaining readability. For instance, I'm pretty sure I won't know what reduceTerms does a month from now...
mbw 2017-03-07 12:24:05
Oh and I probably forgot, but thank you guys for your advice!