+module test
+
+:: DList a = Nil | Cons a (Link (DList a))
+:: Link a = {prev :: a, next :: a}
+
+fromList :: ([a] -> DList a)
+fromList = go Nil
+where
+ go :: (DList a) [a] -> DList a
+ go prev [] = Nil
+ go prev [a:as] =
+ let head = Cons a {prev=prev,next=tail}
+ tail = go head as
+ in head
+
+toList :: (DList a) -> [a]
+toList Nil = []
+toList (Cons el {next}) = [el:toList next]
+
+nil :: DList a
+nil = Nil
+
+(:!) infixr 0 :: a (DList a) -> DList a
+(:!) elh Nil = Cons elh {prev=nil,next=nil}
+(:!) elh (Cons elt link) =
+ let tail = Cons elt {link & prev=head}
+ head = Cons elh {prev=nil,next=tail}
+ in head
+
+Start =
+ (toList (1 :! 2 :! 3 :! nil)
+ ,toList (fromList [1,2,3])
+ )