Riddle me this

Posted in haskell
11 comments on “Riddle me this
  1. sclv says:

    this is a terrible hack, but no more of a hack than printf itself:

    test :: (HPrintfType r, NoOp r) => Bool -> Handle -> String -> r
    test b = if b then hPrintf
    else nopr

    class NoOp a where
    nopr :: a

    instance NoOp (IO a) where
    nopr = return undefined

    instance (NoOp r) => NoOp (a -> r) where
    nopr = const $ nopr

    don’t have an answer for the second bit at the moment tho.

  2. brian says:

    Don’t forget package ‘xformat’.

  3. Saizan says:

    I got a solution requiring more extensions but that it looks more general, here’s the paste:

    The types, especially those inferred like in test, aren’t so pretty but not horrible either.

  4. Saizan: Wow, that’s impressive. Type signatures longer than the code they describe? Eeek!

  5. Saizan says:

    well, the typeclass system is what’s doing most of the work 😛

  6. Ajaj says:

    When my son was born his middle name was to be after my feahtr in law and it was not a cool name Ned. I waited until an hour before I left the hospital to finish the birth certificate paperwork because it wasn’t my favorite name at all, but I wanted to honor my feahtr in law. Maybe that’s what took her so long debating do I go with nicer sounding names, or go with my heart? so then the newspaper went and printed his name as Cotton Ned , instead of Colton Ned as it should have been. NICE!

  7. I've always wanted to set a book in Spain at the time of the Reconquista (Christians drove the Moors south to Granada).Another interesting period would be 1492, when Ferdinand and Isabella expelled the remaining Moors AND the Jews from Spain.

  8. Ooooo I am an ANGEL! And the winds screams… untill you give me something to belive in, and untill you give me something to stick my teeth in. The winds cry SM guld and I be there for you.Now lets finsh what we started!

  9. Feeling exhausted and wrung out from a day at work? Sat in a chair, with a to do list that stretches to the ceiling and glued to your chair? Impatient and stressed? Take those feelings into your practice and you’ll find strength, again through your breath, that enables you to go deeper into each pose. You actively enjoy the feelings of discomfort as you stretch contracted, knotted muscles and connect with the stress, so you can let it go. Again, it’s all about leaning into the sharp corners.

  10. to me: don’t forget about those things/those people, but put them away, don’t carry them around. They are a part of you, but they don’t define you. I LOVE that! A post-it-note with the book analogy is bound for my day-timer as I write!!

  11. http://www./ says:

    Really interesting stuff. There must be many more untold tales from that world that need to be recorded before everyone involved is too old or too dead to talk about it.

1 Pings/Trackbacks for "Riddle me this"
  1. […] little while ago, Bryan O’Sullivan was developing his Criterion benchmark suite, and had trouble with using the Text.Printf module in a monad transformer on top of IO. I thought I knew how to solve this, but my first idea didn’t work — and nor did my […]

Leave a Reply

Your email address will not be published. Required fields are marked *