Skip to content

Instantly share code, notes, and snippets.

@kuribas
Last active February 11, 2023 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuribas/f61ee0a2566c7123728c6494800da6d3 to your computer and use it in GitHub Desktop.
Save kuribas/f61ee0a2566c7123728c6494800da6d3 to your computer and use it in GitHub Desktop.
nested implicits
module Main
import Data.Maybe
import Decidable.Equality
import Data.Vect
hogefuga : {foo : {len : Nat} -> String -> Vect len String} -> Vect 2 String
hogefuga {foo} = foo {len=2} "foobar"
motif : {len : Nat} -> String -> Vect len String
motif {len} str = replicate len str
rap : Vect 2 String
rap = hogefuga {foo=motif}
module Main
import Data.Maybe
import Decidable.Equality
import Data.Vect
hogefuga : {foo : {a:Type} -> Show a => {len : Nat} -> a -> Vect len String} -> Vect 2 String
hogefuga {foo} = foo (the (List String) ["foobar"])
motif : Show a => {len : Nat} -> a -> Vect len String
motif {len} str = replicate len (show str)
rap : Vect 2 String
rap = hogefuga {foo=motif}
module Main
import Data.Maybe
import Decidable.Equality
import Data.Vect
hogefuga : {foo : {len : Nat} -> String -> Vect len String} -> Vect 2 String
hogefuga {foo} = foo {len=2} "foobar"
hogefuga : {foo : {a:Type} -> Show a => {len : Nat} -> a -> Vect len String} -> Vect 2 String
hogefuga {foo} = foo {a=List String} {len=2} ["foobar"]
motif : Show a => {len : Nat} -> a -> Vect len String
motif {len} str = replicate len (show str)
rap : Vect 2 String
rap = hogefuga {foo=motif}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment