Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / mlton / atoms / profile-exp.fun
CommitLineData
7f918cf1
CE
1(* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 *)
7
8functor ProfileExp (S: PROFILE_EXP_STRUCTS): PROFILE_EXP =
9struct
10
11open S
12
13datatype t =
14 Enter of SourceInfo.t
15 | Leave of SourceInfo.t
16
17val toString =
18 fn Enter si => concat ["Enter ", SourceInfo.toString si]
19 | Leave si => concat ["Leave " , SourceInfo.toString si]
20
21val layout = Layout.str o toString
22
23val equals =
24 fn (Enter si, Enter si') => SourceInfo.equals (si, si')
25 | (Leave si, Leave si') => SourceInfo.equals (si, si')
26 | _ => false
27
28local
29 val newHash = Random.word
30 val enter = newHash ()
31 val leave = newHash ()
32in
33 val hash =
34 fn Enter si => Word.xorb (enter, SourceInfo.hash si)
35 | Leave si => Word.xorb (leave, SourceInfo.hash si)
36end
37
38end