Skip to content

Commit

Permalink
remove asInstanceOf
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed May 5, 2023
1 parent c748176 commit bf8d8b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ trait AdtInterpreterSafeSnippet {
for {
_ <- tell(s"put($key, $value)")
_ <- modify((map: Map[String, Any]) => map.updated(key, value))
r <- fromEither(Either.catchNonFatal(().asInstanceOf[X]))
r <- fromEither(Either.catchNonFatal(()))
} yield r

case Get(key) =>
for {
_ <- tell(s"get($key)")
m <- get[U, Map[String, Any]]
r <- fromEither(Either.catchNonFatal(m.get(key).asInstanceOf[X]))
r <- fromEither(Either.catchNonFatal(m.get(key)))
} yield r

case Delete(key) =>
for {
_ <- tell(s"delete($key)")
_ <- modify((map: Map[String, Any]) => map - key)
r <- fromEither(Either.catchNonFatal(().asInstanceOf[X]))
r <- fromEither(Either.catchNonFatal(()))
} yield r
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ trait AdtInterpreterSnippet {
case Put(key, value) =>
println(s"put($key, $value)")
kvs.put(key, value)
().asInstanceOf[X]
()

case Get(key) =>
println(s"get($key)")
kvs.get(key).asInstanceOf[X]
kvs.get(key)

case Delete(key) =>
println(s"delete($key)")
kvs.remove(key)
().asInstanceOf[X]
()
}

def applicative[X, Tr[_]: Traverse](ms: Tr[KVStore[X]]): Tr[X] =
Expand Down

0 comments on commit bf8d8b2

Please sign in to comment.