more Haskell operations;
authorwenzelm
Thu, 13 Dec 2018 15:32:54 +0100
changeset 69459 bbb61a9cb99a
parent 69458 5655af3ea5bd
child 69460 5ffe7e17f770
more Haskell operations;
src/Tools/Haskell/Haskell.thy
src/Tools/Haskell/Test.thy
--- a/src/Tools/Haskell/Haskell.thy	Thu Dec 13 15:21:34 2018 +0100
+++ b/src/Tools/Haskell/Haskell.thy	Thu Dec 13 15:32:54 2018 +0100
@@ -1397,6 +1397,34 @@
     \([], a) -> App (pair term term a)]
 \<close>
 
+generate_file "Isabelle/UUID.hs" = \<open>
+{-  Title:      Isabelle/UUID.hs
+    Author:     Makarius
+    LICENSE:    BSD 3-clause (Isabelle)
+
+Universally unique identifiers.
+
+See \<^file>\<open>$ISABELLE_HOME/src/Pure/General/uuid.scala\<close>.
+-}
+
+module Isabelle.UUID (random, random_string, parse)
+where
+
+import Data.UUID (UUID)
+import qualified Data.UUID as UUID
+import Data.UUID.V4 (nextRandom)
+
+
+random :: IO UUID
+random = nextRandom
+
+random_string :: IO String
+random_string = UUID.toString <$> random
+
+parse :: String -> Maybe UUID
+parse = UUID.fromString
+\<close>
+
 generate_file "Isabelle/Byte_Message.hs" = \<open>
 {-  Title:      Isabelle/Byte_Message.hs
     Author:     Makarius
--- a/src/Tools/Haskell/Test.thy	Thu Dec 13 15:21:34 2018 +0100
+++ b/src/Tools/Haskell/Test.thy	Thu Dec 13 15:32:54 2018 +0100
@@ -18,7 +18,7 @@
       val _ =
         GHC.new_project tmp_dir
           {name = "isabelle",
-           depends = ["bytestring", "network", "split", "utf8-string"],
+           depends = ["bytestring", "network", "split", "utf8-string", "uuid"],
            modules = modules};
 
       val (out, rc) =