Skip to content

Instantly share code, notes, and snippets.

@ir4y
Created December 11, 2015 14:53
Show Gist options
  • Select an option

  • Save ir4y/8d2e915579b954eea635 to your computer and use it in GitHub Desktop.

Select an option

Save ir4y/8d2e915579b954eea635 to your computer and use it in GitHub Desktop.
import Focus
import Array
import Maybe
atL Int -> a -> Focus (Array.Array a) a
atL index default = Focus.create ((Maybe.withDefault default) << (Array.get index))\
(\f r -> (Array.set index
(f (Maybe.withDefault default (Array.get index r)))
r))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment