---
# System prepended metadata

title: Question

---

# Question

##### Part 1
Implement a minimal `Option` that has `map` and `flatMap`.

```scala
import scala.{Option => _}

sealed trait Maybe[+A]{
    def map[B](f: A => B): Maybe[B]
    def flatMap[B](f: A => Maybe[B]): Maybe[B]
}

case object Empty extends Maybe[Nothing]{
    override def map[B](f: A => B): Maybe[B] = Empty
    override def flatMap[B](f: A => Maybe[B]): Maybe[B] = Empty
}

final case class Just[+A](value: A) extends Maybe[A] {
    override def map[B](f: A => B): Maybe[B] = Just(f(value))
    override def flatMap(f: A => Maybe[B]): Maybe[B] = f(value)
}



```

##### Part 2
Implement `fold`
    
```scala  
import scala.{Option => _}


```

