Skip to content

Instantly share code, notes, and snippets.

@edwinb

edwinb/app.idr Secret

Created July 26, 2020 23:38
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 edwinb/9b5dfda2ddf402133ab5d2ce47e85f3e to your computer and use it in GitHub Desktop.
Save edwinb/9b5dfda2ddf402133ab5d2ce47e85f3e to your computer and use it in GitHub Desktop.
Some type driven synthesis, with not very informative types
append : List a -> List a -> List a
{-
Main> :t append
Main.append : List a -> List a -> List a
Main> :gd 1 append -- "Generate defs for 'append' on line 1"
append xs ys = ys
----
append xs ys = xs
----
append xs ys = []
----
append [] ys = ys
append (x :: xs) ys = xs
----
append [] ys = ys
append (x :: xs) ys = ys
----
append [] ys = ys
append (x :: xs) ys = []
----
append [] ys = ys
append (x :: xs) ys = x :: append xs xs
----
append [] ys = ys
append (x :: xs) ys = x :: append xs ys --- got there in the end :)
----
append [] ys = ys
append (x :: xs) ys = x :: append xs []
----
append [] ys = ys
append (x :: xs) ys = x :: append xs (x :: xs)
----
append [] ys = ys
append (x :: xs) ys = x :: append xs (x :: ys)
----
append [] ys = ys
append (x :: xs) ys = x :: append xs [x]
----
append [] ys = ys
append (x :: xs) ys = x :: append xs (x :: (x :: xs))
----
append [] ys = ys
append (x :: xs) ys = x :: append xs (x :: (x :: ys))
.... more ....
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment