News for hackers. Stuff that matters.
Re:1ML – unifying ML into one language by andolanra on Thursday April 23, 2015 @03:56AM (#9425433)
We could in fact write mkMap in Idris with very little change, and give it a proper type:

    -- This might not be the best/cleanest way of writing it, as my
    -- Idris is a little rusty, but this will work:
    mkMap : (size: Int) -> (if size > threshold then HashMap else TreeMap)
    mkMap size with (size > threshold)
      | True  = newHashMap
      | False = newTreeMap
So yes, although again, other tradeoffs are made to allow this kind of radical expressiveness.

There are no comments on this comment yet.