Skip to content

Commit

Permalink
refactor(stdlib)!: Change readFile to return String rather than ELi…
Browse files Browse the repository at this point in the history
…st<String>

BREAKING CHANGE: stdlib signature changed
  • Loading branch information
bristermitten committed Jun 1, 2024
1 parent e2786a0 commit 01f4048
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions jvm-stdlib/elara/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public static IO<Unit> println(String s) {
});
}

public static IO<EList<String>> readFile(String path) {
public static IO<String> readFile(String path) {
return new IO<>(() -> {
try {
return EList.fromList(Files.readAllLines(Paths.get(path)));
return new String(Files.readAllBytes(Paths.get(path)));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
2 changes: 1 addition & 1 deletion prim.elr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let empty = elaraPrimitive "empty"
def (|>) : a -> (a -> b) -> b
let (|>) a f = f a

def readFile : String -> IO [String]
def readFile : String -> IO String
let readFile = elaraPrimitive "readFile"

def ioBind : IO a -> (a -> IO b) -> IO b
Expand Down

0 comments on commit 01f4048

Please sign in to comment.