Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarcelineVQ/ff0e8bd3ac144782dec9ab6f3e35e267 to your computer and use it in GitHub Desktop.
Save MarcelineVQ/ff0e8bd3ac144782dec9ab6f3e35e267 to your computer and use it in GitHub Desktop.
<jacks2> "*** Exception: Text.ParserCombinators.Parsec.Prim.many: combinator 'many' is applied to a parser that accepts an empty string."
<monochrom> rev is recursive. This is the one you can rewrite.
<jacks2> is there a way to force this, despite that message?
<monochrom> I'll let you take time to accept it.
<liiae> monochrom: so the first rule, if a function A would be another functionB's fixed point, that B must be a recursive function at first?
<liiae> so we can have A = fix B
* gienah (~mwright@gentoo/developer/gienah) has joined
<awpr> `reverse' = const Prelude.reverse`
<jacks2> nevermind, I fixed it it
<ezzieyguywuf> I'm very confused about how to add a dependency using stack
<koz_> ezzieyguywuf: You add it to the cabal file.
<ezzieyguywuf> koz_: I thought I needed it add it to stack.yaml
<koz_> ezzieyguywuf: No.
<liiae> awpr: what???
<koz_> stack.yaml doesn't specify build deps.
<ezzieyguywuf> wat does stack.yaml specify?
<MarcelineVQ> https://docs.haskellstack.org/en/stable/stack_yaml_vs_cabal_package_file/
<monochrom> I think you misworded it. "fix B" is recursive. B itself probably not.
<liiae> awpr: that would mean reverse is the only fixed point of reverse?
<koz_> What MarcelineVQ posted.
<Cale> liiae: If the fixed point of a function f is another function g, then f must both take and produce another function.
<ezzieyguywuf> I thought that if I didn't touch the cabal file that stack would manage it for me
<koz_> ezzieyguywuf: Nope.
<koz_> That's not a thing.
<monochrom> And I don't even always define "A = fix B". Sometimes I just go ahead use "fix B" without giving it a name.
<Cale> (but maybe that has nothing to do with the question)
<koz_> Are you perhaps thinking of package.yaml?
<ezzieyguywuf> MarcelineVQ: I think I need to read that link thank you
<monochrom> So you probably need to grow out of wanting to see "=" somewhere.
<ezzieyguywuf> I'm probably thinking of package.yaml!
<awpr> `fix (const x) === x` for any `x`, so you can always find a `g` such that `fix g === f`, namely `const g`
<awpr> it's not really in the spirit of the exercise, though
<koz_> If it's package.yaml, there's a place to put build dependencies: https://github.com/sol/hpack#top-level-fields
<awpr> I mean `const f`
<monochrom> awpr: I think after these two days it's pretty clear we're being hit by an XY problem.
* gienah has quit (Read error: Connection reset by peer)
* fragamus_ (b8faf60c@gateway/web/cgi-irc/kiwiirc.com/ip.184.250.246.12) has joined
<awpr> it's a somewhat weirdly written coding exercise, check out the codewars link
<monochrom> The real exercise has always been "here is a function written recursively already. your job is to replace recursion by fix"
<liiae> awpr https://www.codewars.com/kata/5443dd2d7fc4478154000ac6 so this question has no anwser?
<awpr> `const reverse` is technically an answer; there are many possible answers
<monochrom> But it's butchered into the Y problem "how to 'unfix'". (What the hell does that even mean?) And it is nothing to do with the real exercise.
<monochrom> OTOH my evil twin says it's AOK, XY problem should deserve derailing answers like "yeah x = fix (const x) generally, done"
<monochrom> "just is served"
<monochrom> err, "justice is served"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment