Something like this without mdo, but with mfix s.t. it compiles: insert_after Nothing elem = mdo elem_ref<-newSTRef (Link elem head_ref next_ref) head_ref<-newSTRef (Head elem_ref) return elem_ref