Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/elf_section_header_table.lem
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ let rec read_elf32_section_header_table' endian bs0 =
else
read_elf32_section_header_table_entry endian bs0 >>= fun (entry, bs1) ->
read_elf32_section_header_table' endian bs1 >>= fun sht ->
return (sht ++ [entry])
return (entry :: sht)

(** [read_elf64_section_header_table' ed bs0] parses an ELF64 section header table
* from byte sequence [bs0] assuming endianness [ed]. Assumes [bs0] is of the
Expand All @@ -653,7 +653,7 @@ let rec read_elf64_section_header_table' endian bs0 =
else
read_elf64_section_header_table_entry endian bs0 >>= fun (entry, bs1) ->
read_elf64_section_header_table' endian bs1 >>= fun sht ->
return (sht ++ [entry])
return (entry :: sht)

(** [read_elf32_section_header_table sz ed bs0] parses an ELF32 section header
* table from a [sz] sized prefix of byte sequence [bs0] assuming endianness
Expand Down
8 changes: 4 additions & 4 deletions src/error.lem
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ let rec repeatM' count seed action =
action seed >>= fun (head, seed) ->
repeatM' (count - 1) seed action >>= fun (tail, seed) ->
return (head::tail, seed)

(** [mapM f xs] maps [f] across [xs], failing if [f] fails on any element of [xs].
*)
val mapM' : forall 'a 'b. ('a -> error 'b) -> list 'a -> error (list 'b) -> error (list 'b)
let rec mapM' f xs acc =
let rec mapM' f xs rev_acc =
match xs with
| [] -> acc
| x::xs -> mapM' f xs (acc >>= fun tl -> f x >>= fun hd -> return (hd::tl))
| [] -> rev_acc >>= fun rev_acc -> return (List.reverse rev_acc)
| x::xs -> mapM' f xs (rev_acc >>= fun tl -> f x >>= fun hd -> return (hd::tl))
end

val mapM : forall 'a 'b. ('a -> error 'b) -> list 'a -> error (list 'b)
Expand Down