@Bolt sure - I'm using stuff from GHC.Exts.Heap - specifically, getClosureData, which extracts info about Haskell value
Because in case of constructors, that info includes package and constructor name, I can say if value I'm holding is one of Bool constructors - if it is, I apply not to it, otherwise I keep it as-is
This sounds like a fun challenge:
https://www.reddit.com/r/haskell/comments/70ixk0/code_challenge_bad_id/
It's actually pretty easy with right tools :big_smile: :
There's so much going on! Mind explaining a bit what "tools" are you using? :smiley:
@Bolt sure - I'm using stuff from GHC.Exts.Heap - specifically,
getClosureData
, which extracts info about Haskell valueBecause in case of constructors, that info includes package and constructor name, I can say if value I'm holding is one of
Bool
constructors - if it is, I applynot
to it, otherwise I keep it as-isOne more thing is that I'm forcing value to make sure that I actually get a constructor and not e.g. thunk that could evaluate to
Bool
Cool!
I liked the solution that used rewrite rules too it seemed clever
Yeah - I went for "reliable" one :big_smile: